0

I have a Windows 10 Professional (Anniversary Update) machine PC1 with user user1 (Administrator) and a Windows 7 Professional machine PC2 with user user2 (Administrator). They both belong to a workgroup (not a domain) called MYWORKGROUP and they are in the same LAN, with private addresses (192.168.1.x).

Running Powershell as Administrator from user1 in PC1, I followed this guide as suggested in the comments and I also included PC1 in the list of trusted hosts of PC2 with

winrm set winrm/config/client '@{TrustedHosts="PC1"}'

as suggested in the answer.

Then I logged in PC2 as user2 and ran from Powershell console

PS C:\>$cred = Get-Credentials

I gave my username as PC1\User2 and my PC1 password. Then I ran

Enter-PSSession -ComputerName "PC1" -Credential $cred

The error it gives is now:

PS C:\> Enter-PSSession -ComputerName "PC1" -Credential $cred
Enter-PSSession : Connecting to remote server PC1 failed with the following error message : Access is
denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName PC1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (PC1:String) [Enter-PSSession], PSRemotingTransportExceptio
   n
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

In such a scenario, what else should be done in order to make the Powershell console in PC2 able to run remote commands in PC1?

Note that user user2 exists in both PC1 and PC2 with (now) the same password; anyway, in PC1 it is not Administrator. Maybe should it?

  • What error did you get when you tried to execute Enter-PSSession PC1? – cascer1 Sep 15 '16 at 8:43
  • @cascer1 I edited my question with the error message. – BowPark Sep 15 '16 at 11:20
  • You may find some helpful info here blogs.msdn.microsoft.com/wmi/2009/07/24/… – root Sep 15 '16 at 12:56
  • 1
    When done correctly, should see PC1\User2 or PC2\USer2 depending on which machine you are on. Without the leading machine name, it is assumed to be the current or local machine. User2 without the lead indicates it is the current local PC – bvaughn Sep 16 '16 at 15:32
  • 1
    Possible, need to set rights at either the user level or the group level – bvaughn Sep 16 '16 at 16:25
1

You should add your PC2 to the TrustedHosts on PC1 by running this on PC1:

winrm set winrm/config/client '@{TrustedHosts="PC2"}'
  • I've done it, thank you, but the connection still gives error. – BowPark Sep 16 '16 at 14:24
  • Is it the same error? Access denied? – peter.ruzicska Sep 19 '16 at 9:11
  • Yes, access denied. The problem was about the rights of user2 on PC1 (he was not Administrator), as said in the comments above. – BowPark Sep 19 '16 at 11:38

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.