Jump to content

WMI - problems accessing \root\cimv2


Recommended Posts

A utility of mine (ReProfiler) works on all the computers I have tested it on here, but reportedly fails in some specific (and rather obscure) circumstances on others. I think I've traced the problem to a failure to access the \root\cimv2 WMI object, which in this case is queried to get user-account information. Aut2EXE is 3.3.0.0

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
if @error then 
  msgbox(0,"WMI Error","This computer shows the error")
  exit
endif  
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

I can simulate the problem here by disabling the WMI service, but I doubt if this is the actual issue.

-Any ideas?

Link to comment
Share on other sites

What makes you think WMI service is running on those failing units? Check for that service first. After that it would be some kind of permissions issue.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

What makes you think WMI service is running on those failing units?

:mellow:

You may have a point. Perhaps I could include some diagnostic checks in the code. The only other thing I can think of is a firewall or 'Internet Security' package that's blocking access to WMI.

Link to comment
Share on other sites

WMI might also be screwed up on those machines.

I've had to use the procedure on this page http://windowsxp.mvps.org/repairwmi.htm more than once when WMI queries weren't performing as expected.

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...