Testing WMI (Windows Management Instrumentation) Connectivity in Windows

WMI (Windows Management Instrumentation) provides a special interface in Windows used to manage the local or remote operating systems. WMI provides access to any operating system settings, hardware, system services, drivers, and applications.

The WMI service is critical to perform various management and administration tasks, and if it doesn’t work correctly, it can cause clients on the network to become unmanageable.

To quickly check the health of the WMI service on the local computer, you can use the Get-WmiObject PowerShell cmdlet:

Get-WmiObject -Query "Select * from win32_bios"

This simple WMI query should display information about your computer’s BIOS.

ADVERTISEMENT

windows management instrumentation

You can use Get-WmiObject to test WMI on a remote machine. Just add the -ComputerName parameter and specify the DNS name or IP address of the remote host:

Get-WmiObject -Query "Select * from win32_bios" -ComputerName wks221s

Note. You can request administrator credentials to connect to a remote computer:

Get-WmiObject -Query "Select * from win32_bios" -ComputerName wks221s -Credential "MYDOMAIN\jbrion"

This command may return an error:

Get-WmiObject : The RPC server is unavailable.

windows wmi

Check if the Windows Management Instrumentation (Winmgmt) service is running on the remote computer:

Get-service Winmgmt

test wmi connectivity

Also check that the inbound WMI connections are allowed on the remote computer in Windows Defender Firewall. Enable the Windows Management Instrumentation (WMI-In) rule.

You can enable these firewall rules using PowerShell:

Enable-NetFirewallRule -Name "WMI-WINMGMT-In-TCP", "WMI-RPCSS-In-TCP"

windows management instrumentation service

Hint. In PowerShell Core 6.x+, WMI is not supported (because PowerShell Core is based on .Net Core). When running the Get-WmiObject command in pwsh.exe, the error “The term ‘Get-WmiObject’ is not recognized as a name of a cmdlet, function, script file, or executable program” will appear. Use CIM instead of WMI cmdlets.

wmi windows management instrumentation

The following command will query WMI data via CIM:

ADVERTISEMENT
Get-CimInstance -Query "Select * from win32_bios"

test wmi connection

You can use the built-in wbemtest GUI tool to connect to a local or remote WMI namespace. You can use wbemtest to test if WMI works properly:

  1. Run the command:
    wbemtest
  2. Click the Connect button and enter the WMI Namespace you want to connect to. To connect to WMI on a remote computer, use the following connection string:
    \\TargetComuteroot\cimv2

    wmi management

  3. Click the Query button and enter any WMI query. For example: SELECT * FROM Win32_OperatingSystem;
    windows instrumentation management service
  4. If WMI works correctly, the utility will return a set of WMI objects. Double click on any entry. In this example, the WMI object contains information about the operating system of the computer.
    windows wmi tool

On Windows, WMI object properties are stored in a special repository located in %SystemRoot%\System32\WBEM\Repository.

The winmgmt.exe command line tool is used to manage the WMI repository.

For example, run the following command in order to check the consistency of the WMI repository:

winmgmt.exe /verifyrepository

WMI repository is consistent

service windows management instrumentation

To check the WMI repository and fix all errors immediately:

ADVERTISEMENT
winmgmt.exe /salvagerepository

To reset the WMI database to its default state, run:

winmgmt.exe /resetrepository
I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.