Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Powershell geeks,

I am basically a C# guy but my requirement is to give Powershell access to the remote/target systems (Say Client) from my system (Say Server). I am part of the administrator group in those remote/target machines. Also, all the systems including mine are in the same domain.

What I have tried:

I tried running these commands in my system (Server)-

> Enable-PSRemoting -Force

> Invoke-Command -ComputerName client01,client02 -ScriptBlock { SET -executionPolicy ExecutionPolicy Unrestricted }


I get following error message-
Connecting to remote server client01,client02 failed with following error message: The Client cannot connect to the destination specified in the request. Verify that the service running on the destination to analyze and configure the WinRM service.
Posted
Updated 22-Jan-18 0:06am
v2

1 solution

The system where you enter Invoke-Command -ComputerName is a client and the remote systems passed as arguments are servers here.

So you have to execute Enable-PSRemoting on the remote systems and not on yours:
You have to run this command only one time on each computer that will receive commands. You do not have to run it on computers that only send commands. Because the configuration starts listeners, it is prudent to run it only where it is needed.
 
Share this answer
 
Comments
Vidyadhargk9 23-Jan-18 23:49pm    
Hey @Jochen, thanks for responding. I totally understand this. But I am trying to replicate the things which is achieved by running to Enable-PSremoting Command in remote machine (Like Enabling WinRM firewall exception, Create WinRM listener on HTTP, enable WinRM service etc.). Unfortunately, I am running into the requirement which demands me to achieve this from the source machine.
Jochen Arndt 24-Jan-18 2:44am    
That won't work without providing remote access first.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900