Enable PowerShell Remoting

0
4265
PowerShell

The Windows PowerShell remoting features are supported by the WS-Management protocol and the Windows Remote Management (WinRM) service that implements WS-Management in Windows. Computers running Windows 7 and later include WinRM 2.0 or later. On computers running earlier versions of Windows, you need to install WinRM 2.0 or later as appropriate and if supported.
To verify the availability of WinRM and configure a PowerShell for remoting, run the following PowerShell command as Administrator.
get-service winrm

To configure Windows PowerShell for remoting, type the following command:
Enable-PSRemoting –force
Remember the following rule about WinRM.
In the machine that has been joined to Active Directory Domain:

  • WinRm is enabled on all Windows Server 2012/2016 by default, that means you can access your domain-joined Windows Server out of the box with your domain admin credentials as shown above (Enter-PSSession)
  • WinRm is disabled by default on ALL client operating systems (Windows 7/8/10), that means you cannot access these computers out of the box. You have to enable winrm with the command winrm qc, Enable-PSRemoting, or with Group Policies.

In the machine that uses Workgroup

  • In a workgroup environment, you have to edit the Trusted Hosts list, because in an Active Directory Domain the computers trust each other, but not in a stand-alone scenario

To add the remote computer to the list of trusted hosts for the local computer in WinRM. Run the following command on the remote computer.
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value ‘*’
Or if you want to restrict remote connections to one computer (for example IP-Address: 192.168.0.1). Run the following command.
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value ‘192.168.0.1’
You can check the value of the TrustedHost list by run the following command:
Get-Item -Path WSMan:\localhost\Client\TrustedHosts

LEAVE A REPLY

Please enter your comment!
Please enter your name here