Windows WinRM Error: WSManSubscribe API Restriction
Description
This error occurs because Windows Remote Management (WinRM) strictly enforces security policies for push-based event subscriptions. The WSManSubscribe API requires the calling process to run under the built-in Network Service (NT AUTHORITY\Network Service) account. If a background service, monitoring tool, or script attempts to initialize a push subscription using a standard user, Local System, or local Administrator account, Windows blocks the request and triggers this error.
Step-by-Step Fixes
Depending on what is triggering the error (a custom script, a third-party service, or a scheduled task), use one of the following methods to resolve the issue.
Method 1: Change the Service Log On Account
If the error is caused by a Windows Service (such as a monitoring agent or data collector):
- Press
Windows Key + Rto open the Run dialog box. - Type
services.mscand press Enter. - Locate the service that is generating the WinRM error.
- Right-click the service and select Properties.
- Navigate to the Log On tab.
- Select the This account radio button.
- Type
NT AUTHORITY\Network Servicein the text box. Leave the password fields completely blank. - Click Apply and then click OK.
- Right-click the service again and select Restart.
Method 2: Configure a Scheduled Task to Run as Network Service
If the error originates from an automated script or executable running via Task Scheduler:
- Press
Windows Key + R, typetaskschd.msc, and press Enter. - Locate the specific task running the script or software in the Task Scheduler Library.
- Right-click the task and select Properties.
- In the General tab, look under the Security options section and click Change User or Group....
- In the object name box, type
Network Serviceand click Check Names. - Click OK to confirm the change.
- Ensure that Run with highest privileges is checked if the task requires elevated permissions.
- Click OK and restart or run the task to verify the fix.
Method 3: Switch from Push Subscriptions to Pull Subscriptions
If you are developing a custom PowerShell script or application using WinRM and cannot run it under the Network Service account, you must change the architectural approach:
- Locate the configuration file or source code where the WinRM event subscription is defined.
- Modify the subscription delivery mechanism from Push to Pull.
- Pull subscriptions do not utilize the restricted
WSManSubscribeAPI for listener creation and can be executed by standard administrator accounts.
ERROR_WSMAN_URI_NON_DMTF_CLASS | ERROR_WSMAN_URI_WRONG_DMTF_VERSION | ERROR_WSMAN_EVENTING_NONDOMAINJOINED_PUBLISHER | ERROR_WSMAN_EVENTING_NONDOMAINJOINED_COLLECTOR | ERROR_WSMAN_CONFIG_READONLY_PROPERTY
There may be some errors. Learn Microsoft