Querying WMI remotely with PowerShell is very useful in Windows day to day administration and scripting. Windows PowerShell provides a simple mechanism to connect to Windows Management Instrumentation (WMI) on a remote computer. But sometimes it is not working as excepted and it is frustrating.
Remote WMI is affected by the Windows Firewall, DCOM settings, and User Account Control (UAC).
You can have the following errors when connecting to WMI remotely with PowerShell.
In this case:
Check the WinRM service:
Run the winrm e winrm/config/listener to see the WiinRM status.
Run the WinRM quickconfig (winrm qc) to enable the WinRM service. This sets the WinRM with default configuration.
Add a Windows firewall exception for remote WMI connections:
Run the following command on the remote computer
netsh advfirewall firewall set rule group=”Windows Remote Management” new enable=yes
Run a Get-WmiObject to test the connection.
And you are ready to remote script 🙂
Be the first to comment on "Remote WMI query with PowerShell"