473,471 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

WMI - System.Management.ManagementEx*ception

Dear Group

I wonder whether anyone has some information on the cause for this
error? I've created a class for Win32_BIOS with mgmtclassgen
Win32_BIOS /L VB, added the file to my VB.NET project and tried calling
a property with the following code in a button_click event:

Dim PCBios As New ROOT.CIMV2.Win32.BIOS
Debug.WriteLine(PCBios.Version*)

I get the same error with other generated Win32 classes and their
properties.

The error is:
An unhandled exception of type 'System.Management.ManagementException'
occurred in system.management.dll

Additional information: Not found

The error occurs as an example in BIOS.VB at this location in the line
(highligted green) containing the RETURN statement:
Public ReadOnly Property Version As String
Get
Return CType(curObj("Version"),String*)
End Get
End Property

Thanks for your help and efforts!

Martin

Nov 21 '05 #1
1 2474
Hi Group

It looks like I solved the problem. Just for fellow folks experiencing
the same issue, here's what I've done:
Followed MSDN for 'Management Strongly Typed Class Generator
(Mgmtclassgen.exe)'
http://msdn.microsoft.com/library/de...lassgenexe.asp

Note that there's a a little flaw in the documentation. The following
line didn't work for VB.NET and C#:
mgmtclassgen Win32_LogicalDisk /n root\cimv2 /l VB /p c:\disk.vb

Change it to the following and it should to the trick (Note the order
of the options):
MgmtclassGen Win32_Logicaldisk /L VB /N root\cimv2 /P c:\logicaldisk.vb

I then created a VB.NET Windows Application, referenced
System.Management.dll and added logicaldisc.vb to the assembly.

Next I did add a new class called App and pasted the following code
(with some modifications):

Imports System
Imports System.Management

Public Class App
Public Shared Sub Main()

' Initialize the instance of LogicalDisk with
' the WMI instance pointing to logical drive d:.
Dim dskC As New
MSDN_WMI_SAMPLE.ROOT.CIMV2.Win32.Logicaldisk(New
ManagementPath("win32_LogicalDisk.DeviceId=""c:""" ))
Console.WriteLine("Getting Drive C: Information...")
Console.WriteLine("Caption: " + dskC.Caption)
Console.WriteLine("SystemName: " + dskC.SystemName)
Console.WriteLine("VolumneName: " + dskC.VolumeName)
Console.WriteLine("VolumneSerialNumber: " +
dskC.VolumeSerialNumber)

End Sub
End Class

And finally I created a button on a form and put the following in the
click_event

App.Main()

The error is gone and I hope this example will provide some info on how
to get info from WMI. Spent hours to get it working finally!

Martin

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Cindy Lee | last post by:
when I try to send a large web service message with a c# client, I get a read time out (it has nothing to do with timing out). It's not a sever problem, cus it works fine with a java client and...
1
by: Cindy Lee | last post by:
I get a readtimeout error when I send a webservice over 80k. I don't think a c# string can handle that lengh, or do i need to reserve memory for it? It's not a time out error, because if I send a...
1
by: Eric Simmons | last post by:
Hello, I am trying to run a .NET 2.0 application that I developed and I am getting the following error: Key not valid for use in specified state I am attempting to retrieve the...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.