Auto Prompt for Credential using Profile.ps1 (March 9, 2015)

Like many I have two user accounts on my domain. My regular user that does all my user things, login into my PC, check my email, etc. and my superuser account that I use for administering servers. This poses a little annoyance, that every time I try to do something awesome on my desktop in powershell I have to provide my superuser credentials.

My solution is to add a line into my profile.ps1 so that each time I open a new powershell window I get prompted to enter my superuser password and BAM! I have the credential object $cred ready to go whenever I need it.

$cred = Get-Credential -UserName 'Domain\My_SuperUser' -Message 'Store in $cred'
Here be dragons, or a footer. Both work.