[Solved] Cannot find an overload for PSCredential

You may encounter the following error message:

New-Object : Cannot find an overload for "PSCredential" and the argument count: "2".

This happens because you try to pass the password as a regular string.

You must use a secure string instead.

For example convert your string with the ConvertTo-SecureString cmdlet.

Or, if you use the Read-Host cmdlet, associate it with the AsSecureString parameter.

Leave a comment