Home > PowerShell > Suppress “Supply values for the following parameters: Credential” when using Get-Credential in PowerShell

Suppress “Supply values for the following parameters: Credential” when using Get-Credential in PowerShell

When you want to ask the user for alternative credentials, the Get-Credential cmdlet is your friend.

You get a nice popup, asking you for a username and password.

image

But your PowerShell console always displays this nasty message:

image

Basically, this message pops up because the –Credential parameter is not supplied.  Whatever you supply as –Credential, will automatically be filled in as the User Name in the dialog box.  If you want to leave the User Name field blank, just pass the $null value and you’re set.

Get-Credential -Credential $null

 

image

No output is generated in the PowerShell console window… just what we wanted!

Advertisements
Categories: PowerShell
  1. August 4, 2011 at 13:25

    Nice catch. I always wondered how to get rid of this message.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: