I am writing a PowerShell script on a Windows 8.1 machine. When trying to create a PSCredential object using New-Object cmdlet, I was presented with this error:
New-
Also remember that if you don't need a specific credential other than the current credential of the person running the command (or script), you can skip all this with a one-liner:
$Cred = Get-Credential
A popup will then prompt you to enter your username and password. Just like that, you've captured your credentials in a variable that you can use at the command line or you can use this in a script to prompt the user for their credentials.