If you want to launch PowerShell as a different user other than administrator, you won’t find a Run As menu to enter other credentials. After a bit of searching, I found that the following code works best in launching a new PowerShell windows as a different user.
1 2 3 4 5 6 7 8 9 10 | # Define domain username and password $username = 'domain\user' $password = 'kvnbZJSSJAUTBFB5' # Convert to a single set of credentials $securePassword = ConvertTo-SecureString $password -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential $username, $securePassword # Launch PowerShell (runas) as another user Start-Process powershell.exe -Credential $credential -WindowStyle Maximized |
The window that opens, however, looks like a command prompt windows (white text on black background) instead of like a PowerShell window (white text on a blue background).
If for some reason you open you session in another drive example F:\ make sure you change to C:\ or this will throw an error…
Thanks Tim for the comment. I was not able to reproduce your problem. For me, the same command worked on C: as it did on D:.