Jump to content

Testing WMI functionality


Recommended Posts

I'm getting a handle on WMI and how to query. One thing I'd like to do is know if the WMI on a remote PC is running, and if possible, if it's broken.

I tried one possible method of using "wmic os" to check it. But what I found was when I stopped the WMI process and ran "wmic os" on the local PC, it restarted the WMI service, then reported the data. No error messages or anything.

Link to comment
Share on other sites

  • Moderators

As far as WMI service running, you can use something like this:

$objComputer = ObjGet("WinNT://<pcname>,computer")
$objComputer.Filter = 'Array("Service")'

For $aService In $objComputer
 If $aService.Name = "Wmi" Then MsgBox(0, "", $aService.Status)
Next

For whether WMI is working correctly, once you try to query it, you'll receive an error if there is a problem.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...