Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

How to enable or disable WinRM via the command-line

Posted on 26/07/202330/06/2026 Christian By Christian No Comments on How to enable or disable WinRM via the command-line
  1. Home
  2. Windows
  3. 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.

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
Windows, Windows Server Tags:Configure WinRM, configure WinRM cmd enable quickconfig, disable WinRM service Windows Server, Enable disable WinRM command line Windows, enable WinRM PowerShell and cmd, reset WinRM configuration Windows, troubleshoot WinRM cmd commands, Windows 10, Windows 11, Windows Remote Management command line setup, Windows Server 2016, WinRM firewall rule command line, WinRM listener configuration command line, WinRM service start stop commands

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

  • Featured image System Tray icons
    How to Fix System Tray Icons not showing in Taskbar on Windows 11 Windows
  • Secure Boot 2023 Compliance for wds e1781352448233
    Secure Boot 2023 Compliance Across WinPE, MDT, WDS, and ADK: Boot Chain Alignment and PXE Validation [Final Part] Windows
  • image 9
    Fix Error 853: The remote access connection completed, but authentication failed because the certificate that authenticates the client to the server is not valid Network | Monitoring
  • ghfg 1
    Handy WSUS Commands: Windows Server Update Services Commands, WAUACLT, PowerShell and USOClient Windows Server
  • Featured image 2
    Microsoft Account Password Reset via Web and Windows Windows
  • Screenshot 2022 04 27 at 17.51.48
    Remote Desktop Services Setup on Windows Server Windows Server

More Related Articles

ADO Self hosted agent How to Create Self-Hosted Agent for Azure DevOps Pipelines Automation
maxresdefault How to fix Error reading setup initialization file Windows
Specifiy the right credential for adding a domain Specify user account name when adding a DC to an existing Forest Windows Server
Featured image new How to update the BIOS on your Dell system Security | Vulnerability Scans and Assessment
Featured image 1 How to Change User Account Type in Windows 10 Windows
mdm Delete AssignedAccess applied via MDM WMI bridge Provider Windows

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • Fixed drives not encrypted by BitLocker via MBAM
    Why is BitLocker unable to encrypt Removable Drives via MBAM? Windows
  • VMware Error Fix
    How to fix “The process cannot access the file because another process has locked a portion of the file” Virtualization
  • linux tux minimalism 4k 42 2560x1700 1 1
    Warning useradd: the home directory already exists. Not copying any file from skel director into it Linux
  • Docker Volumes
    Create and Mount Volume to Docker Container Containers
  • How to integrate your phone and other devices with Microsoft Edge
    Integrate your phone and other devices with Microsoft Edge Windows
  • How To Stop Mac From Sleeping Automatically
    How to prevent macOS from going to sleep Mac
  • systemd services
    How to use Systemd Timers on Linux Linux
  • Uninstall Wampserver
    How to uninstall WAMPServer from Windows Web Server

Subscribe to Blog via Email

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

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

Tags

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

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.