[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 Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s