473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

unhandled COMException, Catastrophic failure

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
5 2980
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Damaji Jambhale | last post by:
COMException: Catostrphic failure When I added a "dll" reference in the web project. I was able to instantiate the class OK. But when I tried to set the properties, it failed with...
12
by: eddie wang | last post by:
I got the following when opening up a page. It usually happens after I modify one page(not connections.asp) without refresh in IE. I have to refresh the IE browser and the error usually will go...
2
by: MeAndI | last post by:
Hi, I've create a custom com object and I use it as follow: set test = Server.CreateObject(myObject.classID) ' --> all OK the istance of the object is correctly created retval =...
4
by: J. Marshall Latham | last post by:
I have written an ASP.NET web app in C# that is trying to connect to a database using OleDb. I put code in a dll that uses another dll to create a connection object (and open it if requested) to...
0
by: Veibert M Pinontoan | last post by:
I try to create wrapper for WMSyncReader. The code is :using System; using System.Runtime.InteropServices; namespace WMFSDKWrapper { public class WMFSDKFunctions { public static extern uint...
0
by: joef | last post by:
I'm running VS on my PC (W2K) connected to a remote IIS server (W2K) SP4 that is not a domain controller. I've got the ASPNET and IWAM accounts in the "Impersonate a client after authentication"...
0
by: joef | last post by:
I'm running VS.net on my PC (W2K) connected to a remote IIS server (W2K) SP4 that is not a domain controller. I've got the ASPNET and IWAM accounts in the "Impersonate a client after...
5
by: Tony M. | last post by:
I just want to share a discovery. I was using a sub routine to call itself, a recursive loop. In it I used ADO to process records, and I was getting a "Catastrophic Failure", almost always...
2
by: Frav | last post by:
The Reps team have been experiencing that Access 2002 unexpectedly quits while working and also lots of Corruption Failures and "Record lock can not update" messages since the upgrade from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.