WMI error using System.Management.ManagementClass

G

Guest

I've got a VB.NET windows application (written in VS .NET 2003) that makes a
call to WMI for retrieving the MAC Address from the client's PC. It works on
4 out of the 5 PC's tested so far. All the workstations are DELLs running XP
SP1a with the 1.1 .NET Framework. The following line of code generates an
exception on the one PC:

Dim oMac As New
System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")

The error it generates is:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
system.management.dll
Additional information: The specified module could not be found.
Additional information: The type initializer for
"System.Management.MTAHelper" threw an exception.
System.TypeInitializationException: The type initializer for
"System.Management.ManagementPath" threw an exception. --->
System.TypeInitializationException: The type initializer for
"System.Management.MTAHelper" threw an exception. --->
System.IO.FileNotFoundException: The specified module could not be found.
at System.Management.MTAHelper..cctor()
--- End of inner exception stack trace ---
at System.Management.MTAHelper.CreateInMTA(Type type)
at System.Management.ManagementPath.CreateWbemPath(String path)
at System.Management.ManagementPath..ctor(String path)
at System.Management.ManagementPath..cctor()
--- End of inner exception stack trace ---
at System.Management.ManagementPath..ctor(String path)
at System.Management.ManagementClass..ctor(String path)
at SEMS.ClientControls.CookieLib.GetMACAddress() in CookieLib.vb:line 55

We've tried the following items to no avail:
1) shutting down the WMI Service, deleting the repository, and restarting
the service.
2) Reinstalling the .NET framework, SP1a, and all the windows updates except
for SP2.
3) Confirming the services are running
4) Running the app while logged in as Administrator
5) Reinstalling the network adapter
6) We have VS 2003 installed on this PC so we installed the WMI Extensions
for VS 2003 Server explorer. It installed w/o any errors, however when you
click on the "Management Classes" item in the treeview it throws the same
exception.

Any insight into what we can do to determine why the exception occurs and
what we can do to fix this would be greatly appreciated.
 
W

Willy Denoyette [MVP]

Try using wbemtest.exe from the commandline, try to connect to root\cimv2
and execute the same query - (select * from
Win32_NetworkAdapterConfiguration).

If this doesn't work (which I expect) it's not a .NET issue.

Willy.
 
G

Guest

Hi Paul,

How the problem was solved? I am having same problem.
I've got a VB.NET windows application (written in VS .NET 2003) that makes a
call to WMI for retrieving the MAC Address from the client's PC. It works on
4 out of the 5 PC's tested so far. All the workstations are DELLs running XP
SP1a with the 1.1 .NET Framework. The following line of code generates an
exception on the one PC:

Dim oMac As New
System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")

The error it generates is:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
system.management.dll
Additional information: The specified module could not be found.
Additional information: The type initializer for
"System.Management.MTAHelper" threw an exception.
System.TypeInitializationException: The type initializer for
"System.Management.ManagementPath" threw an exception. --->
System.TypeInitializationException: The type initializer for
"System.Management.MTAHelper" threw an exception. --->
System.IO.FileNotFoundException: The specified module could not be found.
at System.Management.MTAHelper..cctor()
--- End of inner exception stack trace ---
at System.Management.MTAHelper.CreateInMTA(Type type)
at System.Management.ManagementPath.CreateWbemPath(String path)
at System.Management.ManagementPath..ctor(String path)
at System.Management.ManagementPath..cctor()
--- End of inner exception stack trace ---
at System.Management.ManagementPath..ctor(String path)
at System.Management.ManagementClass..ctor(String path)
at SEMS.ClientControls.CookieLib.GetMACAddress() in CookieLib.vb:line 55

We've tried the following items to no avail:
1) shutting down the WMI Service, deleting the repository, and restarting
the service.
2) Reinstalling the .NET framework, SP1a, and all the windows updates except
for SP2.
3) Confirming the services are running
4) Running the app while logged in as Administrator
5) Reinstalling the network adapter
6) We have VS 2003 installed on this PC so we installed the WMI Extensions
for VS 2003 Server explorer. It installed w/o any errors, however when you
click on the "Management Classes" item in the treeview it throws the same
exception.

Any insight into what we can do to determine why the exception occurs and
what we can do to fix this would be greatly appreciated.

User submitted from AEWNET (http://www.aewnet.com/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top