I want to use winrm remote vm, I can connect to the localhost, but I can't connect to the other remote machine, the error is "access is denied".
Asked
Active
Viewed 3.3k times
2 Answers
8
You need to provide -Credential
parameter:
Enter-PSSession –ComputerName Server –Credential Domain\UserName

Andrey Marchuk
- 13,301
- 2
- 36
- 52
-
1Assuming `Enable-PSRemoting` has been run on both machines, and Set-Item wsman:\localhost\Client\TrustedHosts -Value *` has been run on yours (I have seen this generate an Access Denied error) – Deadly-Bagel May 19 '16 at 08:29
-
I tried,but it still not working.the error doesn't change. – Hoi Fong Iam May 19 '16 at 08:33
-
You might need to set `-Authentication Default` – Andrey Marchuk May 19 '16 at 08:35
5
So I was having the EXACT same issue as this user and found the issue. Basically I was running the commands as my Domain Admin account but the servers are locked down to not accept network connections from Domain Admin accounts in Group Policy as a security measure. Once changing the command credentials to run as my non domain admin account and an account allowed network access with administrative permissions the enter-pssession command worked perfectly. What I don't understand is why the test-wsman command appears to work.

Jamie Lawson
- 53
- 2
- 5