Fix for WinRM HTTP 500 Server Error
Description
This error occurs when a WinRM (Windows Remote Management) client attempts to connect to a remote server, but the remote IIS (Internet Information Services) or WinRM service encounters an internal server error (HTTP 500). Because it is a generic server-side failure, the remote service fails to provide specific details to the client.
This issue typically stems from misconfigured WinRM service settings, corrupted WS-Management configurations, authentication mismatches, lack of sufficient user permissions, or conflicting third-party software (like antivirus or firewalls) blocking the execution environment on the target machine.
Step-by-Step Fixes
Perform these troubleshooting steps on the remote target machine you are trying to connect to.
Step 1: Restart the WinRM Service
Sometimes the service enters a glitched state and needs a fresh start.
- Open PowerShell or Command Prompt as an Administrator.
- Run the following command to stop the service:
net stop winrm - Run the following command to start the service:
net start winrm
Step 2: Repair the WinRM Configuration
Resetting and checking the default quick configuration can repair corrupted listeners and firewall rules.
- Open PowerShell as an Administrator.
- Type the following command and press Enter:
winrm quickconfig - If prompted to make changes to configure the listener and enable the firewall exceptions, press
Yand thenEnter.
Step 3: Increase WinRM Memory Allocation
The HTTP 500 error frequently happens because the remote shell runs out of allocated machine memory when processing requests.
- Open PowerShell as an Administrator.
- Check the current memory limit by running:
Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB - Increase the memory limit to 1024 MB (or higher if needed) by running:
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 1024 - Restart the WinRM service to apply changes:
Restart-Service winrm
Step 4: Verify LocalAccountTokenFilterPolicy (For Workgroups)
If you are connecting to a machine that is not part of an Active Directory domain, Windows User Account Control (UAC) might restrict administrative privileges over remote connections.
- Open PowerShell as an Administrator.
- Execute the following command to allow remote administrative tasks for local accounts:
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "LocalAccountTokenFilterPolicy" -Value 1 -PropertyType DWord -Force
Step 5: Check Application Pool and IIS (If Applicable)
If your WinRM traffic is routed through an IIS proxy or custom endpoint:
- Open the IIS Manager on the remote server.
- Navigate to Application Pools.
- Ensure that the application pool managing the WinRM or WS-Management endpoint is running and has not crashed.
There may be some errors. Learn Microsoft