[2005] WMI namespace and classes
Hi guys, how do I get the namespace and classes w/ the specific property.
The user input a certain property then the application will query on what namespace and class it is under.
i.e IPaddress it's under root/cimv2 namespace and win32_networkadapterconfiguration class.
thanks in advance guys.
Re: [2005] WMI namespace and classes
The System.Management is not imported by default into the project, right click on Reference to display the "Add Reference" form, select "System.Management" from the .NET tab.
Re: [2005] WMI namespace and classes
If I'm reading this correctly you want to get a list of all classes that have a property with a name specifed by the user. That's like saying you want a list of all the people with a particular shoe size. How woul;d you do that but measure the foot of every person? The property doesn't specify the class. The class specifies the property, so you will just have to check every class to see if it has a property with the specified name.
Re: [2005] WMI namespace and classes
I've done it, using reflection, but it was really just more of a pain. The MySystemSpy program in my sig is what it was for, queries all of the WMI classes that the user chooses by just clicking on em. Check out my WMI codebank for examples and a DLL that I created that could come in handy, it would be easier to just do select cases for the WMI classes you want, because each class has specific sets of properties, and each sets of properties are different for each class, with some being arrays, etc.
The example in my sig has a way to pull up the general properties, just be a matter of passing in the string you want that has the Win32 class you wish to use. Problem with it is that some properties have numerical values that have no meaning unless you look up the values in the documentation, which by using the DLL might remedy a lot of that...
Re: [2005] WMI namespace and classes
Quote:
Originally Posted by jmcilhinney
If I'm reading this correctly you want to get a list of all classes that have a property with a name specifed by the user. That's like saying you want a list of all the people with a particular shoe size. How woul;d you do that but measure the foot of every person? The property doesn't specify the class. The class specifies the property, so you will just have to check every class to see if it has a property with the specified name.
Yeah, quite a big problem for me considering there are thousand of classes in each namespace. :eek:
Actually our scripters here use the dll's we created about wmi and they're just going to input the property and in our dll's it managed to get the value of it. Before you could get the value of a property you must know on what namespace and classes it's under then get the value. Our dll's is doing good but it's not complete we still have to add some property based on the demand of the scripters. So I come up of an child-to-parent idea, meaning input value is child then know who's the parent.
gigemboy: I try to check it out.
btw thanks for all the reply guys.