WinRM: Difference between revisions

From Omnia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
</pre>
</pre>


--
== WinRM Service ==
 
Enable with script from: <ref>https://docs.ansible.com/ansible/latest/os_guide/windows_setup.html</ref>
https://raw.githubusercontent.com/ansible/ansible-documentation/ae8772176a5c645655c91328e93196bcf741732d/examples/scripts/ConfigureRemotingForAnsible.ps1
 
Example:
  $url = "https://raw.githubusercontent.com/ansible/ansible-documentation/ae8772176a5c645655c91328e93196bcf741732d/examples/scripts/ConfigureRemotingForAnsible.ps1"
  $file = "c:\ci\ConfigureRemotingForAnsible.ps1"
  (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
  powershell.exe -ExecutionPolicy ByPass -File $file
 
Service -
 


  Service:  "WinRM" - "Windows Remote Management (WS-Management)"
  Service:  "WinRM" - "Windows Remote Management (WS-Management)"
Line 31: Line 43:
  net stop WinRM
  net stop WinRM
  net start WinRM
  net start WinRM
== Check Config ==
winrm get winrm/config
== keywords ==

Revision as of 05:31, 14 June 2024

Test WinRM:

Not a valid API call, but verifies if WinRM service is listening:

# curl -i -k https://moonshadow.home.lab:5986
HTTP/2 404
content-type: text/html; charset=us-ascii
server: Microsoft-HTTPAPI/2.0
date: Thu, 28 Mar 2024 18:24:22 GMT
content-length: 315

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Not Found</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Not Found</h2>
<hr><p>HTTP Error 404. The requested resource is not found.</p>
</BODY></HTML>

WinRM Service

Enable with script from: [1]

https://raw.githubusercontent.com/ansible/ansible-documentation/ae8772176a5c645655c91328e93196bcf741732d/examples/scripts/ConfigureRemotingForAnsible.ps1

Example:

 $url = "https://raw.githubusercontent.com/ansible/ansible-documentation/ae8772176a5c645655c91328e93196bcf741732d/examples/scripts/ConfigureRemotingForAnsible.ps1"
 $file = "c:\ci\ConfigureRemotingForAnsible.ps1"
 (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
 powershell.exe -ExecutionPolicy ByPass -File $file

Service -


Service:  "WinRM" - "Windows Remote Management (WS-Management)"
C:\Windows\System32\svchost.exe -k NetworkService -p

Windows Remote Management (WinRM) service implements the WS-Management protocol for remote management. WS-Management is a standard web services protocol used for remote software and hardware management. The WinRM service listens on the network for WS-Management requests and processes them. The WinRM Service needs to be configured with a listener using winrm.cmd command line tool or through Group Policy in order for it to listen over the network. The WinRM service provides access to WMI data and enables event collection. Event collection and subscription to events require that the service is running. WinRM messages use HTTP and HTTPS as transports. The WinRM service does not depend on IIS but is preconfigured to share a port with IIS on the same machine. The WinRM service reserves the /wsman URL prefix. To prevent conflicts with IIS, administrators should ensure that any websites hosted on IIS do not use the /wsman URL prefix.

Restart service:

net stop WinRM
net start WinRM

Check Config

winrm get winrm/config

keywords