473,725 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WMI - System.Manageme nt.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.Win3 2.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.Managem ent.ManagementE xception'
occurred in system.manageme nt.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("V ersion"),String *)
End Get
End Property

Thanks for your help and efforts!

Martin

Nov 21 '05 #1
1 2508
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.e xe)'
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_LogicalDi sk /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_Logicaldi sk /L VB /N root\cimv2 /P c:\logicaldisk. vb

I then created a VB.NET Windows Application, referenced
System.Manageme nt.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.Manageme nt

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.Win 32.Logicaldisk( New
ManagementPath( "win32_LogicalD isk.DeviceId="" c:"""))
Console.WriteLi ne("Getting Drive C: Information..." )
Console.WriteLi ne("Caption: " + dskC.Caption)
Console.WriteLi ne("SystemName : " + dskC.SystemName )
Console.WriteLi ne("VolumneName : " + dskC.VolumeName )
Console.WriteLi ne("VolumneSeri alNumber: " +
dskC.VolumeSeri alNumber)

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
1769
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 responds in 0-1 seconds. I'm using apache axis java for my web services server. It's when the web service is around 70k, but it varies depending on which parameters are large. At 50k the webservice c# client works fine.
1
1376
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 file that's 70k, it returns in 1-2 seconds. It's connecting to a java apache axis server, and when I use a java client, it sends the string perfectly. In my .cs file, is there another data type I should change it to, or This is my cs code
1
12516
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 X509Certificate2.PrivateKey as an XML string via the ToXmlString() function and this error occurs. Below is an example of the command line call that I used to make my test
2
4139
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 message is: E:\software\development\boost_1_35_0\boost_1_35_0>bjam -- toolset=msvc-7.1 --variant=release --threading=multi --link=shared --
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
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.