Windows: Reset, enable and configure Powershell remoting

Hi,

here are the steps to reset WinRM service and start from scratch.

Start a cmd.exe shell with Administrator permissions. Stop and disable the service. Delete any config also settings applied by policy.

D:\> sc stop winrm
D:\> sc config winrm start=disabled
D:\> reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN /f
D:\> reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\winrm /f

Restore the basic config

D:\> winrm invoke Restore http://schemas.microsoft.com/wbem/wsman/1/config @{}

And enable again. Enable-PSRemoting does a lot of things:
– QuickConfig
– enable session configuration
– create session endpoints
– create listeners
– adjusts the firewall config
– alters the security descriptors to allow remote access
– enable and restart the service

D:\> sc config winrm start=auto
D:\> powershell -command "& { Enable-PSRemoting }"

Enable HTTPS Listener
Certificate thumbprint can be the computer certificate. To determine an existing use powershell:

PS D:> dir Cert:\LocalMachine\my\*
   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\my

Thumbprint                                Subject
----------                                -------
1123345EA3EFBBBF9EE1032DD33B36EB98        CN=myHostName.myDomain.org
D:\> winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="myHostName.myDomain.org";CertificateThumbprint="1123345EA3EFBBBF9EE1032DD33B36EB98"}

To remove the http listener when only want to use HTTPS

D:\> winrm delete winrm/config/Listener?Address=*+Transport=HTTP

…and re-add

D:\> winrm create winrm/config/Listener?Address=*+Transport=HTTP

Check config

D:\> winrm get winrm/config
winrm enumerate winrm/config/listener

Michael

Advertisment to support michlstechblog.info

0 thoughts on “Windows: Reset, enable and configure Powershell remoting”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.