By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,991 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,991 IT Pros & Developers. It's quick & easy.

unhandled COMException, Catastrophic failure

P: n/a
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

The following code works fine for me. A couple of things to keep in
mind. First wmi is not installed by default on windows 95, 98, and nt 4.0.
Second win32_operatingsystem only works with windows xp, 2000, 2003, and nt
4.

Link wmi redist package
http://www.microsoft.com/downloads/d...displaylang=en

Code
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_OperatingSystem")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} - Serial Number {1}", mo("Name"),
mo("SerialNumber"))

Trace.WriteLine(strOut)

Next

Ken

-------------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?
Nov 21 '05 #2

P: n/a
Thank you for your quick response.
I'm using WinXp Pro with SP1,
I deleted the System.Management reference and added it again, but your code
causes the same error for me, as mine. An interesting thing, that I can't
catch this exception with 'Catch E As Exception'.

M.

"Ken Tucker [MVP]" wrote:
Hi,

The following code works fine for me. A couple of things to keep in
mind. First wmi is not installed by default on windows 95, 98, and nt 4.0.
Second win32_operatingsystem only works with windows xp, 2000, 2003, and nt
4.

Link wmi redist package
http://www.microsoft.com/downloads/d...displaylang=en

Code
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_OperatingSystem")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} - Serial Number {1}", mo("Name"),
mo("SerialNumber"))

Trace.WriteLine(strOut)

Next

Ken

-------------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?

Nov 21 '05 #3

P: n/a
Hi,

Go to add remove programs in the control panel. Click on
add/remove windows components. Make sure management and monitoring tools is
checked that is the wmi.

Finally Catch e as exception will only catch non fatal errors. Use
to catch e as system.exception to catch all exceptions.

Ken
---------------------
"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Thank you for your quick response.
I'm using WinXp Pro with SP1,
I deleted the System.Management reference and added it again, but your code
causes the same error for me, as mine. An interesting thing, that I can't
catch this exception with 'Catch E As Exception'.

M.

"Ken Tucker [MVP]" wrote:
Hi,

The following code works fine for me. A couple of things to keep
in
mind. First wmi is not installed by default on windows 95, 98, and nt
4.0.
Second win32_operatingsystem only works with windows xp, 2000, 2003, and
nt
4.

Link wmi redist package
http://www.microsoft.com/downloads/d...displaylang=en

Code
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_OperatingSystem")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} - Serial Number {1}", mo("Name"),
mo("SerialNumber"))

Trace.WriteLine(strOut)

Next

Ken

-------------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type
'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?

Nov 21 '05 #4

P: n/a
You were right, the management and monitoring tools were not installed at my
PC, I installed it (in details WMI SNMP Provider also checked), made reboot
and tried again. Unfortunately the same error occured.
I tried catch it with 'Catch e As Ssystem.Exception', but it didn't help.

Do You know another way to get the same informations about the PC?

"Ken Tucker [MVP]" wrote:
Hi,

Go to add remove programs in the control panel. Click on
add/remove windows components. Make sure management and monitoring tools is
checked that is the wmi.

Finally Catch e as exception will only catch non fatal errors. Use
to catch e as system.exception to catch all exceptions.

Ken
---------------------
"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Thank you for your quick response.
I'm using WinXp Pro with SP1,
I deleted the System.Management reference and added it again, but your code
causes the same error for me, as mine. An interesting thing, that I can't
catch this exception with 'Catch E As Exception'.

M.

"Ken Tucker [MVP]" wrote:
Hi,

The following code works fine for me. A couple of things to keep
in
mind. First wmi is not installed by default on windows 95, 98, and nt
4.0.
Second win32_operatingsystem only works with windows xp, 2000, 2003, and
nt
4.

Link wmi redist package
http://www.microsoft.com/downloads/d...displaylang=en

Code
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_OperatingSystem")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} - Serial Number {1}", mo("Name"),
mo("SerialNumber"))

Trace.WriteLine(strOut)

Next

Ken

-------------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type
'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?


Nov 21 '05 #5

P: n/a
Hi,

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

MyRegKey = myReg.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion")

Trace.WriteLine(MyRegKey.GetValue("ProductID"))

Trace.WriteLine(MyRegKey.GetValue("RegisteredOwner "))

MyRegKey.Close()

Ken

---------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:44**********************************@microsof t.com...
You were right, the management and monitoring tools were not installed at my
PC, I installed it (in details WMI SNMP Provider also checked), made reboot
and tried again. Unfortunately the same error occured.
I tried catch it with 'Catch e As Ssystem.Exception', but it didn't help.

Do You know another way to get the same informations about the PC?

"Ken Tucker [MVP]" wrote:
Hi,

Go to add remove programs in the control panel. Click on
add/remove windows components. Make sure management and monitoring tools
is
checked that is the wmi.

Finally Catch e as exception will only catch non fatal errors.
Use
to catch e as system.exception to catch all exceptions.

Ken
---------------------
"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
Thank you for your quick response.
I'm using WinXp Pro with SP1,
I deleted the System.Management reference and added it again, but your
code
causes the same error for me, as mine. An interesting thing, that I can't
catch this exception with 'Catch E As Exception'.

M.

"Ken Tucker [MVP]" wrote:
Hi,

The following code works fine for me. A couple of things to
keep
in
mind. First wmi is not installed by default on windows 95, 98, and nt
4.0.
Second win32_operatingsystem only works with windows xp, 2000, 2003, and
nt
4.

Link wmi redist package
http://www.microsoft.com/downloads/d...displaylang=en

Code
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_OperatingSystem")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} - Serial Number {1}", mo("Name"),
mo("SerialNumber"))

Trace.WriteLine(strOut)

Next

Ken

-------------------------------

"mattiassich" <ma*********@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
The following code causes unhandled exception on the line:
New ManagementObjectSearcher(query)

Dim mos As System.Management.ManagementObjectSearcher
Dim moc As System.Management.ManagementObjectCollection
Dim mo As System.Management.ManagementObject
Dim query As String = "SELECT * FROM Win32_OperatingSystem"
mos = New System.Management.ManagementObjectSearcher(query)
moc = mos.Get()
For Each mo In moc
....

The whole error message:
An unhandled exception of type
'System.Runtime.InteropServices.COMException'
occurred in system.management.dll
Additional information: Catastrophic failure

What is wrong?


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.