473,756 Members | 2,721 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 2512
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
1772
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
1377
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
9275
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
10034
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...
1
9843
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
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
6534
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.