Setting Up a Fixed Port for WMI

WMI runs as part of a shared service host with ports assigned through DCOM by default. However, you can set up the WMI service to run as the only process in a separate host and specify a fixed port.

The following procedure is an automated setup to allow WMI to have a fixed port. The procedure uses the winmgmt command-line tool.

Bb219447.wedge(en-us,VS.85).gifTo set up a fixed port for WMI

  1. At the command prompt, type winmgmt -standalonehost
  2. Stop the WMI service by typing the command net stop "Windows Management Instrumentation", or use the short name of net stop winmgmt
  3. Restart the WMI service again in a new service host by typing net start "Windows Management Instrumentation" or net start winmgmt
  4. Establish a new port number for the WMI service by typing netsh firewall add portopening TCP 24158 WMIFixedPort

To undo any changes you make to WMI, type winmgmt /sharedhost, then stop and start the winmgmt service again.


For a script that sets up a fixed port for WMI, see the following Scripting Gallery code sample.

or a PowerShell code example that enables or disables the WMI port settings, see the Set-WmiSinglePort example on TechNet Gallery.

Related topics

Connecting to WMI on a Remote Computer
Troubleshooting a Remote WMI Connections
Provider Hosting and Security