How to fix "The WSMan plugin configuration is corrupted."
Description
This error occurs when the Windows Remote Management (WinRM) configuration becomes corrupted, misconfigured, or has conflicting registry entries. WSMan (Web Services-Management) is the protocol used by WinRM for remote management and PowerShell remoting. When the plugin configuration is damaged, Windows cannot load the necessary WSMAN plugins, preventing local or remote PowerShell commands from executing properly, and disrupting services like Hyper-V manager, Server Manager, or Exchange Management Shell.
Step-by-Step Easy Fix
Follow these steps in order to reset and repair the WSMan configuration.
Step 1: Open PowerShell as Administrator
- Press the Windows Key on your keyboard.
- Type PowerShell.
- Right-click on Windows PowerShell from the search results.
- Select Run as administrator.
- Click Yes if the User Account Control (UAC) prompt appears.
Step 2: Remove the Corrupted WSMan Configuration
You need to delete the corrupted WSMan listener and configuration template from the Windows Registry so Windows can recreate it cleanly.
- In the Administrator PowerShell window, type the following command and press Enter:
Remove-Item -Path "WSMan:\localhost\Plugin\*" -Recurse -Force - Next, clear the listener configuration by running this command and pressing Enter:
Remove-Item -Path "WSMan:\localhost\Listener\*" -Recurse -ForceNote: If these commands return an error stating the path does not exist, proceed directly to Step 3.
Step 3: Restart the WinRM Service
Restarting the service ensures that any cached corrupted configurations are completely cleared from system memory.
- Type the following command and press Enter:
Restart-Service -Name WinRM -Force
Step 4: Reinitialize and Repair WinRM (Quick Config)
This command triggers the built-in Windows repair utility for remote management. It automatically recreates the default WSMan plugins, sets up standard listeners, and opens required firewall exceptions.
- Type the following command and press Enter:
winrm quickconfig - The system will display the current status and ask for confirmation to make changes.
- Type y (for Yes) and press Enter when prompted to enable the service and create the listeners.
Step 5: Verify the Fix
Ensure that the WSMan plugins are now loading correctly without errors.
- Type the following command to list the active plugins and press Enter:
Get-ChildItem -Path "WSMan:\localhost\Plugin" - You should see a list of default plugins (such as
microsoft.powershell,microsoft.powershell.workflow, orWMI Provider) without any error messages. - Test local remoting capability by running this command and pressing Enter:
Enter-PSSession -ComputerName localhost - If the prompt changes to indicate you are connected to
[localhost], the error is successfully resolved. TypeExitto close the session.
ERROR_WSMAN_INVALID_FILEPATH | ERROR_WSMAN_FILE_NOT_PRESENT
There may be some errors. Learn Microsoft