Jump to content
Sign in to follow this  
Anteaus

WMI - problems accessing \root\cimv2

Recommended Posts

Anteaus

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?

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
Anteaus

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.

Share this post


Link to post
Share on other sites
ResNullius

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.

Share this post


Link to post
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
Sign in to follow this  

×