Windows – WMI: How to fix the port

firewallportwindowswmi

I need to use WMI for getting some information from my servers. But I have a server in DMZ, so I need to open a port in my firewall. I've searching and I found that WMI uses random port.
How can this be fixed?

Best Answer

The following procedure is an automated setup to allow WMI to have a fixed port. The procedure uses the winmgmt command-line tool. To 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"
  3. Restart the WMI service again in a new service host by typing net start "Windows Management Instrumentation"
  4. Establish a new port number for the WMI service by typing netsh firewall add portopening TCP 24158 WMIFixedPor