Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Contact
  • Reviews
  • Toggle search form
Home » Network | Monitoring » How to enable or disable WinRM via the command-line
  • Featured image Microsoft Outlook
    How to Recall an Email in Microsoft Outlook Network | Monitoring
  • images copy
    HA-Proxy Configuration File: Copy Between Nodes on Proxmox VE Virtualization
  • powershell01
    How to create a KDS root key using PowerShell Scripts
  • Package1
    Install Synaptic Package Manager: Handle packages in Ubuntu Linux
  • Screenshot 2022 04 28 at 22.35.11
    Fix “There was a problem starting logilda.dll” in Windows Windows
  • requestedlogon
    Error 1385: The user has not been granted the requested logon type at this time Network | Monitoring
  • Microsoft Enterprise Root Certification Authority and Forest Domain to Azure migration
    Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure AWS/Azure/OpenShift
  • header picture
    Creating and Deploying Docker Registry Using Docker Image AWS/Azure/OpenShift

How to enable or disable WinRM via the command-line

Posted on 26/07/202301/09/2025 Christian By Christian No Comments on How to enable or disable WinRM via the command-line
enable or disable WinRM

The Windows Remote Management (WinRM) service is Microsoft’s implementation of the WS-Management (WS-Man) protocol introduced in Windows before PowerShell. It allows remote management of your device (hardware and operating systems). For WinRM scripts to run, and for the Winrm command-line tool to perform data operations, WinRM has to be configured. In this article, I will be showing you how to enable or disable WinRM via the command-line. Please see how to fix WSManFault Message 2144108526 0x80338012: Fix the client cannot connect to the destination specified in the request, and How to configure a remote server (windows) to Support Ansible.

WinRM componnets are automatically installed with all currently-supported versions of the Windows operating system. WinRM is started automatically on newer versions of Windows Server, (that is from WS 2008) to be precise at the time of writing this piece. By default, no WinRM listener is configured.

Even if the WinRM service is running, WS-Management protocol messages that request data can’t be received or sent. Internet Connection Firewall (ICF) blocks access to ports. Please see how to fix “Cannot find the computer: Fix the following error occurred while using Kerberos authentication“.

Enable WinRM

To configure the WS-Management protocol on your device, and set up the default configuration for remote management. Please enter the following command below into PowerShell. 

winrm quickconfig
WinRM-QuickConfig

Note: WinRM qucikconfig is abbreviated as winrm qc, and performs the following operations. Please see Concept of Ansible on Windows using Cygwin, how to fix “WinRM cannot complete the operation, verify that the specified computer name is valid, and how to fix “An error occurred while attempting to connect to the server: Check if the Virtual Machine Management service is running or you are not authorized to connect to this server”.

When this service is started, the startup type changes to “Automatic (Delayed)”. Starting the service in itself does not do anything as it does not listen for anything as mentioned above, and stated in the image below.

Therefore, a listener is created. This listener sends and receives WS-Management protocol messages using either HTTP or HTTPS on any IP address.

WinRM-Setup

A firewall exception is created for Windows Remote Management only for the current user profile. If the firewall profile is changed for any reason, then run winrm quickconfig to enable the firewall exception for the new profile (otherwise the exception might not be enabled).

A configuration change is made such that when a remote user connects with admin rights to this machine, the admin rights are not stripped via User Account Control (UAC). Basically, this configuration change involves modifying a registry entry.

Disable WinRM

To disable the effect of winrm quickconfig one must undo each of these changes. Kindly follow the steps below to disable WinRM from running on your device.

Disabling the WinRM Service

Either go via the Services MMC console and stop the WinRM service from running (disabled). Alternatively, use PowerShell as an Administrator. Below are the steps to do this via the command line.

Stop-Service winrm
Set-Service -Name winrm -StartupType Disabled
Stop the Listener Service

Delete the Listener

For me, this step was not necessary. If you disabled the WinRM service as explained above, this disables the listener as well. If you need a listener on another port for an application other than PowerShell, you have to keep the WinRM service running.

Also, note that Server Manager uses the same listener for remote server management as PowerShell remoting. To display the available listeners you can run this command below. For us, there isn’t any listener running.

dir wsman:\localhost\listener
Listener

Note: If you have got some listeners, Once you know the name of the listener, you can remove it with the next PowerShell command.

Remove-Item -Path WSMan:\Localhost\listener\<Listener name>

To remove all listeners, you can use this command below.

Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse

Another security benefit of removing the listener(s) is that if someone starts the WinRM service, this will also activate the listener. However, if you delete the listener before you disable the service, you have to add the listener again with the Enable-PSRemoting cmdlet

Disable Windows firewall exceptions

I will be using the GUI to disable the Firewall exception created via the Windows Defender Firewall With Advanced Security.

Windows Defender Firewall with Advanced Security provides host-based, two-way network traffic filtering and blocks unauthorized network traffic flowing into or out of the local device

As you can see, the exception is still enabled. We have to disable it. To do this, right-click on the rule and select disable rule or click on the rule, and select disable rule on the Action Pane!

Disable Windows Remote Management

As you can see below, the rule has been disabled! Please see how to fix “Connecting to a remote server failed and WinRM cannot process the request: Error code 0x8009030e occurred while using Kerberos authentication, and a specified logon session does not exist“.

Disable Windows Remote Management

To disable the firewall exceptions via PowerShell, please use the following command below

Get-NetFirewallRule | ? {$_.Displayname -eq "Windows Remote Management (HTTP-In)"} | Set-NetFirewallRule -Enabled "False"

Disable Remote UAC

Note: Please set the value of the LocalAccountTokenFilterPolicy to 0. This restricts remote access to members of the Administrators group on the PC. On devices that are not members of the AD domain, WinRM adds the LocalAccountTokenFilterPolicy registry entry to the location below and sets the value to 1.

For me, this was already disabled as shown in the image below as it is a domain joined device.  If this is not your case, please navigate to the following location via the Registry Editor.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

Then set the value of LocalAccountTokenFilterPolicy to 0 (zero).

LocalAccountTokenFilterPolicy

To do this via PowerShell, kindly run the command below.

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name LocalAccountTokenFilterPolicy -Value 0

I hope you found this blog post helpful on how to enable or disable WinRM via the command-line. Please let me know in the comment section if you have any questions.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Network | Monitoring Tags:Configure WinRM, Windows 10, Windows 11, Windows Server 2016

Post navigation

Previous Post: WSManFault Message 2144108526 0x80338012: Fix the client cannot connect to the destination specified in the request
Next Post: How to Integrate Jira Software with GitHub Cloud

Related Posts

  • Reverse Image Search
    How to Perform a Reverse Image Search on Your Browsers Network | Monitoring
  • exchange 2016 1
    How to Block Change Password for Specific Exchange Users Network | Monitoring
  • Install Windows Admin Center on Windows Server 2019
    Configure Windows Admin Center on Windows Server 2019 Network | Monitoring
  • Watchguard Firewall 180504 100511
    WatchGuard Log and Report Server Installation in a VM Network | Monitoring
  • rdp4
    How to change the default RDP port in Windows Network | Monitoring
  • maxresdefault 2 3
    How to configure WatchGuard WebCenter Network | Monitoring

More Related Articles

Reverse Image Search How to Perform a Reverse Image Search on Your Browsers Network | Monitoring
exchange 2016 1 How to Block Change Password for Specific Exchange Users Network | Monitoring
Install Windows Admin Center on Windows Server 2019 Configure Windows Admin Center on Windows Server 2019 Network | Monitoring
Watchguard Firewall 180504 100511 WatchGuard Log and Report Server Installation in a VM Network | Monitoring
rdp4 How to change the default RDP port in Windows Network | Monitoring
maxresdefault 2 3 How to configure WatchGuard WebCenter Network | Monitoring

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • Featured image Microsoft Outlook
    How to Recall an Email in Microsoft Outlook Network | Monitoring
  • images copy
    HA-Proxy Configuration File: Copy Between Nodes on Proxmox VE Virtualization
  • powershell01
    How to create a KDS root key using PowerShell Scripts
  • Package1
    Install Synaptic Package Manager: Handle packages in Ubuntu Linux
  • Screenshot 2022 04 28 at 22.35.11
    Fix “There was a problem starting logilda.dll” in Windows Windows
  • requestedlogon
    Error 1385: The user has not been granted the requested logon type at this time Network | Monitoring
  • Microsoft Enterprise Root Certification Authority and Forest Domain to Azure migration
    Migrate Microsoft Enterprise Root Certification Authority and Forest Domain to Azure AWS/Azure/OpenShift
  • header picture
    Creating and Deploying Docker Registry Using Docker Image AWS/Azure/OpenShift

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,825 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.