Prompt for Credentials without a Dialog Box

by May 29, 2013

Whenever a PowerShell script asks for credentials, PowerShell pops up a dialog box. You can view this by running this command:

Get-Credential

PowerShell is a console-based scripting language, and so it may be unwanted to open additional dialogs. That's why you can change the basic behavior and ask PowerShell to accept credential information right inside the console. This is a per-machine setting, so you need local Administrator privileges and must run these two lines from an elevated PowerShell console:

$key = "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds"
Set-ItemProperty -Path $key -Name ConsolePrompting -Value $true

Twitter This Tip! ReTweet this Tip!