I am using New-PSSession
to create session and connect to our server.
Code I am using looks like this:
$PWord = ConvertTo-SecureString -String $passwordPlain -AsPlainText -Force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName, $PWord
$serverSession = New-PSSession -ComputerName $serverName -Credential $credentials
And it works perfectly. But if my colleague runs it on his PC with same parameters it fails with error: The user name or password is incorrect. For more information, see the about_Remote_Troubleshooting Help topic.
It looks like my colleague does not have permissions to connect there. If this is the case, what are $credentials
for?
We have tried setting -Authentication
to different type, but with no luck.
Then we tried different credentials on my PC and it works.
Have anyone encountered this problem?