Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checks about WinRM service in remote machine

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?.

like image 392
Kiquenet Avatar asked May 29 '12 11:05

Kiquenet


People also ask

How can I tell if WinRM is enabled on a remote computer?

Type the following cmdlet and then hit Enter: "Restart-Service WinRM". It's time to test the connection, From the MID Server execute the following cmdlet into PowerShell and then hit Enter: "Test-WsMan <Target IP>" and This simple command tests whether the WinRM service is running on the remote Host.

How do I check WinRM connectivity?

So before connecting to remote server it is necessary to test remote WINRM connectivity with PowerShell. We need to use Test- WS command for it. If you get the below response, then the WinRM connection is successful. If PSremoting is not enabled or WinRM is blocked by the firewall, you will get an error message.

How do I check WinRM settings?

To get the listener configuration, type winrm enumerate winrm/config/listener at a command prompt. Listeners are defined by a transport (HTTP or HTTPS) and an IPv4 or IPv6 address. winrm quickconfig creates the following default settings for a listener. You can create more than one listener.


1 Answers

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.

like image 141
ravikanth Avatar answered Oct 24 '22 00:10

ravikanth