The default implementation for get-credential now uses the Windows CredUI
functionality for collecting credentials. This is a requirement for being
complaint with Windows Common Criteria. We still retain the console mode
which can be enabled by setting the registry key "ConsolePrompting" under
HLKM:\SOFTWARE\Microsoft\MSH\1\ShellIds to "True" (string)
MSH> SetConsoleCredPrompt
Your Credential Prompting Mode has been changed to "Console" Mode.
MSH> SetConsoleCredPrompt($false)
Your Credential Prompting Mode has been changed to "Gui" Mode.
# author: DBMwS
# date: 01/12/2005 @ 11:14 PM
# description: "Get-Credential" prompting method between "console" and "CredUI"
# note: Works only for Beta 3 of Monad
function SetConsoleCredPrompt() {
# default is $private:false since in Monad Beta 3, CredUI is the default way to
# prompt end-user for entering username and password
# But should i throw an Exception here or not... That's the problem...
param([bool] $ConsoleMode = $private:true)
# Ready for the unexpected...(such as running this script for non beta 3 version of Monad
trap { Write-Host "Some Unknown error has occurred, Aborting Mission..."; return; }
# MSH Beta 3 ShellID
$private:path = [string] "HKLM:\SOFTWARE\Microsoft\MSH\1\ShellIds"
# A new key name to create.
$private:key = [string] "ConsolePrompting"
# Check if the location we need to reach exists or not, else abort the script
if (test-path $private:path) {
set-property $private:path -Property $private:key -Type String -Value $ConsoleMode.ToString()
} else {
throw "Could not find Registry Path($($private:path)) to change Creditial Prompt Setting`nMaybe you are running pre-beta3 MSH?"
}
Write-host -n "Your Credential Prompting Mode has been changed to `""
if($ConsoleMode) { Write-host -n -f "red" "Console" } else { Write-Host -n -f "green" "Gui" }
Write-host "`" Mode."
}
Experimenting with a different format of blogs...