Windows Error Fix: WinRM Encrypted Message Body Invalid Format
Description
This error occurs when a Windows Remote Management (WinRM) client receives an encrypted message that it cannot decrypt. It signifies a mismatch in encryption or authentication configurations between the local client and the remote host. The most common causes include conflicting Kerberos authentication configurations, SPN (Service Principal Name) mismatches, or system time differences between the machines which break the Kerberos ticket validation process.
Step-by-Step Fixes
Perform the following solutions in order until the issue is resolved.
Solution 1: Sync System Time
Kerberos authentication requires the system times on the client and remote host to be synchronized within 5 minutes of each other.
- Click the Start menu and type
cmd. - Right-click Command Prompt and select Run as administrator.
- Type the following command to synchronize time with the domain or network time server:
w32tm /resync - Verify both machines show the exact same current time.
Solution 2: Change Authentication to Basic (Testing Only)
Switching temporarily to Basic authentication bypasses Kerberos encryption issues to determine if Kerberos is the root cause.
- Open an elevated Command Prompt (Run as administrator) on both the client and remote machine.
- Run this command on both machines to allow basic authentication:
winrm set winrm/config/client @{AllowUnencrypted="true"} winrm set winrm/config/client/auth @{Basic="true"} winrm set winrm/config/service/auth @{Basic="true"} - Test your connection. If it works, the issue resides within your Active Directory Kerberos settings or SPNs.
Solution 3: Reset the WinRM Configuration
Corrupted listener configurations can cause encryption mismatches. Resetting the service fixes these structural errors.
- Open an elevated Command Prompt on the remote server.
- Run the following command to completely wipe and recreate the default WinRM configuration:
winrm quickconfig -q - Restart the WinRM service to apply the fresh settings:
net stop winrm && net start winrm
Solution 4: Fix SPN (Service Principal Name) Mismatches
If the remote server has duplicate or missing SPNs, Kerberos cannot encrypt the payload correctly.
- Open an elevated Command Prompt on a domain controller or a machine with Active Directory tools.
- Check for duplicate SPNs using the following command (replace
ServerNamewith your target server's name):setspn -X - If duplicates are found for your WinRM service, delete the invalid duplicate entries using:
setspn -D WSMAN/ServerName ServerName - Re-register the correct SPN using:
setspn -A WSMAN/ServerName ServerName
There may be some errors. Learn Microsoft