|
-
Jul 12th, 2006, 02:26 PM
#1
Thread Starter
Junior Member
[RESOLVED] [2005] unhandled exception system.management...HELP!
i am by no means an expert at this type of code, I am simply trying to put together an app to collect some system information. It has been running well on about 100 out of 130 systems, the other 30 it throws an unhandled exception.
ERROR:
Unhandled Exception: System.Management.ManagementException: Not Found
at System.Management.ManagementScope.Initialize ()
at System.Management.ManagementObjectSearcher.Initialize ()
at System.Management.ManagementObjectSearcher.Get ()
at Inventory.Module1.Main()
CODE (what looks relivent):
Sub Main()
Dim objCS As ManagementObjectSearcher
objCS = New ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
Dim objOS As ManagementObjectSearcher
objOS = New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")
Dim objProc As ManagementObjectSearcher
objProc = New ManagementObjectSearcher("SELECT * FROM Win32_Processor")
Dim oQuery As New System.Management.ObjectQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DriveType=3")
Dim oSearcher As New ManagementObjectSearcher(oQuery)
Dim oReturnCollection As ManagementObjectCollection = oSearcher.Get()
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
'get OS
For Each objMgmt In objOS.Get
OSInfo = objMgmt("name").ToString()
Next
'get model, manufacterer and memory
For Each objMgmt In objCS.Get
Manu = objMgmt("manufacturer").ToString()
Model = objMgmt("model").ToString()
TPM = objMgmt("totalphysicalmemory").ToString()
Next
'get processor name and clock speed
For Each objMgmt In objProc.Get
PClock = objMgmt("maxclockspeed").ToString()
PName = objMgmt("name").ToString()
Next
'get disk space and freespace
For Each oReturn As ManagementObject In oReturnCollection
DSize = oReturn("FreeSpace").ToString()
DSpace = oReturn("Size").ToString()
Next
Anyone have any clue why it might do this on some systems and not others?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|