I'm trying to pull information from PC's over the network such as
SerialNumber, TotalPhysicalMemory, etc. This is what I've got so far...
co = New ConnectionOptions
co.Username = uid
co.Password = pwd
ms = New System.Management.ManagementScope("\\" & PCName &
"\root\cimv2", co)
Public Function GetWmiValue(ByVal WMIClass As String, ByVal WMIProperty
As String) As String
Dim mo As New ManagementObject
mo.Scope = ms
mo.Path = New ManagementPath(WMIClass)
mo.Get()
Return mo.Item(WMIProperty).ToString
End Function
My problem is that I want the function to return the value of the
property. It seems that I have to already KNOW the value of the
property.
I get Invalid Path exception on the mo.Path line. But if I change it
to:
mo.Path = New ManagementPath(WMIClass & ".Name='<somename>')
Then the mo.Get line throws with "Not Found"
*** Sent via Developersdex http://www.developersdex.com ***