PowerShell Credentials for Cmdlets – Get-Credential

I’m sorry that i was so quite the last few weeks. There was a lot to do. Furthermore I tried to enjoy the sun as often as possible ๐Ÿ˜‰ But I’ll still try it hard to post more frequently.

Just a short PowerShell ร”ร‡รดTrick which will save you a lot of time ๐Ÿ˜‰

A lot of Cmdlets need the right credentials to perform a action. Especially with W2008R2 and the AD-Cmdlets or with Exchange 2010 this is handy. So you can either type your username/password every time, or just save it to a variable.

$cred = Get-Credential

After hitting Enter a Pop-Up appears where you can enter your credentials. They will be saved within the variable

The input isn’t validated. It’s just saved within the variable for later processing. And don’t worry, the password isn’t saved as clear text ๐Ÿ˜‰

You can also fill the prompt with a username by using “Get-Credential <Username>”. This is maybe helpful when using that in a script.

You can also use this Pop-Up Mechanism directly in a command.

So have fun playing around with PowerShell ๐Ÿ˜‰

May the Shell be with you J

2 responses to “PowerShell Credentials for Cmdlets – Get-Credential”

  1. ultrasound technician Avatar
    ultrasound technician

    Great information! Iร”ร‡ร–ve been looking for something like this for a while now. Thanks!

  2. What makes you an expert?…

    I found your entry interesting thus I’ve added a Trackback to it on my weblog :)…

Leave a Reply

Your email address will not be published. Required fields are marked *