I am trying to use the ManagementObjectCollection
class to get some system information. However, the attcahed code snippet gives me the errors:
"ManagementClass not defined"
n not defined"
umerator" not defined.
From what I can see in MSDN, I have to import System and System.Management to get these classes.
I have both imports in my code but still get the errors.
I am using Visual Studio.Net (Visual Basic 2008) on a WinXP SP3, .Net 3,.5 PC.
Can someone please advise what I am missing.
Dim ManClass As ManagementClass = New ManagementClass("Win32_ComputerSystem")
Dim ManObj As ManagementObjectCollection = ManClass.GetInstances()
Dim ManOblCollection As ManagementObjectCollection.ManagementObjectEnumerator = ManObj .GetEnumerator
s = ManOblCollection .Current.Properties("CurrentTimeZone").Value.ToString()