How To Enable Powershell Remoting PSRemoting or WinRM? – POFTUT

How To Enable Powershell Remoting PSRemoting or WinRM?


Linux operating systems provide GUI or command line access from its first days. But Windows operating systems are generally managed with only GUI which is generally Remote Desktop. The changes in IT made mass management or orchestration a must for system administrators. Windows have created Powershell for detailed and efficient command line shell and tools. In order to use Powershell remotely we need to enable PSRemoting in target systems. Without enabling it we can not use powershell remote commands like  Invoke-Command .

Error Appeared In Client

We may get an error in a red ink like below in the client side powershell. This generally means that remote system do not configured to accept Powershell remote access.

 + CategoryInfo : OpenError: (:) [], PSRemotingTransportException
 + FullyQualifiedErrorId : PSSessionStateBroken
PSRemotingTransportException
PSRemotingTransportException

Check Status of PSRemoting

Another way to check whether PS remoting is enabled is running following command in the remote system.

PS> Get-PSSessionConfiguration
Check Status of PSRemoting
Check Status of PSRemoting

As we can see there is detailed configuration about PSRemoting. This configuration is done according to Powershell version and user types.

Enable PSRemoting

Now most important part. We will enable the PSRemoting in order to able to run Remote commands using PSRemoting. We will use following command with -force option to prevent some warnings.

PS> Enable-PSRemoting -Force
Enable PSRemoting
Enable PSRemoting

We can again check like in previous step the status of the PSRemoting.

Add Client Host To The Trusted Hosts

If previous steps do not works try following command by changing IP address with the remote system.

PS> winrm s winrm/config/client '@{TrustedHosts="192.168.122.167"}'

LEARN MORE  How To Install and Use Cygwin With Terminal and SSH Examples?

1 thought on “How To Enable Powershell Remoting PSRemoting or WinRM?”

Leave a Comment