Checks about WinRM service in remote machine

Kiquenet picture Kiquenet · May 29, 2012 · Viewed 40.2k times · Source

I have seen great article
PowerShell 2.0 remoting guide: Part 8 – remoting scenarios and troubleshooting
http://www.ravichaganti.com/blog/?p=1181

I have this issue: I have two computers in domain, in network.

First Test OK: Remoting to a computer in domain from a computer in domain

COMPANY_DOMAIN\desmonitor is Domain User.
Domain COMPANY_DOMAIN
Computer: iis01

PS C:\Users\myUser> Enter-PSSession -Computername iisw01 -Credential COMPANY_DOMAIN\desmonitor
[desiisw01]: PS C:\Users\desmonitor\Documents> exit

Second Test Wrong: : Remoting to a computer in domain from a computer in domain, using local administrator user

iis01\instalador is Local User for machine iis01
Computer: iis01

PS C:\Users\myUser> Enter-PSSession -Computername iis01 -Credential iis01\instalador Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot process the request.

In machine ii01 using Terminal Server (Remote Desktop) using COMPANY_DOMAIN\desmonitor, I open PS Console and I execute

PS C:\Users\desmonitor> winrm quickconfig
WinRM already is set up to receive requests on this machine.
WinRM already is set up for remote management on this machine.
PS C:\Users\desmonitor>

Then, I try again but I get same error:

PS C:\Users\myUser> Enter-PSSession -Computername iis01 -Credential iis01\instalador Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot processthe request.

Using this command:

PS C:\Users\myUser> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force PS C:\Users\myUser>

Now, I get access:

PS C:\Users\myUser> Enter-PSSession -Computername iis01 -Credential iis01\instalador [iiw01]: PS C:\Users\instalador\Documents> $Host

Name             : ServerRemoteHost
Version          : 1.0.0.0
InstanceId       : 6905896f-e6c7-4603-82f0-20183f71b1ec
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : es-ES
CurrentUICulture : es-ES
PrivateData      :
IsRunspacePushed :
Runspace         :

In my company, there are many computers to connect to iis01.

Each compute need execute the command for adding the remote computer to local computer’s trusted hosts list ??

I have several questions about it ¿

How can I get list about TrustedHosts (WSMan:\LocalHost\Client ) in local computer ?
How can I know if WinRM service is enabled in a computer ?
How can I know if WinRM service is running in a computer ?
How can I know if WinRM is set up to receive request in a computer ?
How can I know if WinRM is set up for remote management on this machine?.

Answer

ravikanth picture ravikanth · May 29, 2012

Q1. How can I get list about TrustedHosts (WSMan:\LocalHost\Client ) in local computer ?

Get-Item WSMan:\localhost\Client\TrustedHosts

Q2/Q3. How can I know if WinRM service is enabled in a computer ? How can I know if WinRM service is running in a computer ?

Get-Service -ComputerName server01 -Name winrm | Select Status

Q4. How can I know if WinRM is set up to receive request in a computer ? Not very sure on this but I will confirm. One way to find is to see if the client ports are listed or not. But, like I said, I can confirm this.

Get-ChildItem WSMan:\localhost\Client\DefaultPorts

Q5. How can I know if WinRM is set up for remote management on this machine?.

You should be able to list the listeners.

Get-ChildItem WSMan:\localhost\Listener

If you don't see anything here, that means you are not setup for WSMAN incoming connections.