Home All Groups Group Topic Archive Search About

Query VMI with limited right users

Author
11 Apr 2006 8:59 PM
Dany C.
Our application written in VB2005 uses a VMI query to gather some information
about the comuter. The method work well when we run the application with a
user having administration right. However, when we run the application with a
user not having adminstration right (standart user) the following execption
is throw.

System.Management.Managementexception: Initialization failure
at
System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus
errorcode)
at
System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()

Does someone have a idea how to make it works?


Here is the code:
Dim l_uin as string
Dim query As New SelectQuery("Win32_WindowsProductActivation")

' Instantiate an object searcher with this query
Dim searcher As New ManagementObjectSearcher(query)

' Call Get() to retrieve the collection of objects and loop through it
For Each envVar As ManagementObject In searcher.Options.Get()
l_uin = CStr(envVar("ProductID"))
Next envVar

Regards,

AddThis Social Bookmark Button