EdRbt
EdRbt

Reputation: 349

Enter-PSSession returns PSRemotingTransportException

When I try to connect to a remote server using Enter-PSSession, I get a PSRemotingTransportException. It says that the user is either unknown or associated with a wrong password.

It works with other users, and it works with this user on other servers. The user is in the Administrator group of the remote server.

What am I missing?

EDIT

The main problem I have is this. I have three servers: remote1, remote2, and main, one domain: domain, and two users: user1 and user2.

So now I'm connected with user1 on main. The first problem is that when I use Enter-PSSession on remote1, I'm connected via user2:

PS C:\Users\user1> whoami

domain\user1

PS C:\Users\user1> Enter-PSSession remote1

[remote1]: PS C:\Users\user2\Documents> whoami

domain\user2

[remote1]: PS C:\Users\user2\Documents>

The second problem is that when I use Enter-PSSession on remote2, it doesn't work:

PS C:\Users\user1> Enter-PSSession remote2

Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. At line : 1 Char: 16 + Enter-PSSession <<<< remote2 + CategoryInfo : InvalidArgument: (remote2:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

PS C:\Users\user1>

Upvotes: 3

Views: 80285

Answers (5)

Craig Efrein
Craig Efrein

Reputation: 139

I ran into the same problem today where my remote user couldn't connect via powershell with Enter-pssession -ComputerName

If you run the command in a Powershell Administrator Window:

PS C:\Windows\system32> Get-PSSessionConfiguration

The following output appears

PS C:\Windows\system32> Get-PSSessionConfiguration

Name          : microsoft.powershell
PSVersion     : 5.1
StartupScript :
RunAsUser     :
Permission    : NT AUTHORITY\INTERACTIVE AccessAllowed, 
BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllowed

Remote Management Users are allowed access and my remote user, wasn't explicitly assigned to that group. That remote user was defined as an Administrator and I thought that was enough. Once I added my login to the Remote Management Users group explicitly, I was able to connect with powershell.

Nothing else was required, but I did add a rule to restrict the allowed hosts to one IP address.

Set-Item WSMan:\localhost\Client\TrustedHosts -Force -Value my.remote.ip.address

and restarted winrm with restart-service winrm

This is the same solution I use to allow RDP access to users not defined as administrators

Upvotes: 0

amynmerch
amynmerch

Reputation: 11

Your credentials may be cached, I faced the same issue and updated the passowords that were cached in windows using the tool here:

https://security.stackexchange.com/questions/15574/how-do-i-clear-cached-credentials-from-my-windows-profile

Upvotes: 1

Bellicose Agnostic
Bellicose Agnostic

Reputation: 76

I ran into exact same issue too. I have admin account on my local machine at home & remote machine at work. However, since I upgraded to windows 10 at home, I switched to @outlook.com email to get early windows update, but I noticed that the admin account is still there albeit being masked somehow. Right now, I log into windows using pin that I've setup.

So the following for whatever reason won't work, even though i used to work before

Enter-PSSession remote -Credential admin

however this works

Enter-PSSession remote -Credential remteComputerName\admin

All computers are in WORKGROUP, admin account has same password in both machines

Upvotes: 0

nghia.tran
nghia.tran

Reputation: 81

i ran into this same issue. Do you have a password on that user account? I gave mine a password and that issue went away.

hope that helps.

Upvotes: 2

user189198
user189198

Reputation:

Hmmm, that sounds odd.

One possibility is that the default PSSession configuration(s) got messed up. To reset it, use the following code:

Get-PSSessionConfiguration -Name Microsoft.PowerShell | Unregister-PSSessionConfiguration;

And then run:

Enable-PSRemoting -Force;

Also, are you sure that you are using the domain\username format when specifying your credentials (assuming that you're specifying alternate credentials)?

Upvotes: 3

Related Questions