This is a program I completed on 10/16/2011 and I believe is finally ready for prime time.
Those that use the MgmtClassGen.exe tool should find this program very handy for creating the strong type classes quickly.
Before any selections or locations are saved.
Current Version as of 10/16/2011 is 188.8.131.52.
- This program was initially started on Windows XP Pro 32 bit but was completed on Windows Vista 64 Bit version in Visual studio 2008. It has been written entirely in VB.NET.
- This program is a stand alone program, no install is required. Just unzip and go.
- Minimum requirement is .NET version 2.0.
- File size is 146 KB.
- The idea for the namespace / class list layout was actually inspired by the Microsoft Scripting Guys Scriptomatic 2.0, where I modified it to be able to view every namespace and class, not just the dynamic ones. Then I adapted the idea for this program.
Builds of the strong type classes seem to fail if you choose an output folder away from the root (C:\Saved_Classes). I am not sure if it is folder permissions or a Path Length problem. It does not seem to matter on the location of the MgmtClassGen.exe file.
When choosing a MgmtClassGen.exe file, I have found it works best if you are running a 64 bit OS then use the file from the x64 folder otherwise use the one from the level above it. I have found no way to tell the difference in the 32 bit and 64 bit files because they have the exact same file version. There are also different .NET versions (see the screenshot below).
The program takes a few seconds to start up after clicking the program icon to find all of the namespaces.
When there are a lot of classes to load, it can take a few seconds to load the classes in the listbox. My system will load about 1011 cimv2 classes into the listbox, so just wait till the count is up and then it's ready.
Location of the MgmtClassGen.exe for the program is hardcoded in the button click to the path C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64. If the program fails to find the folder, then it seems to revert to the current user documents folder.
While testing the program for the VJ – JSharp (J#), it failed to build that version even after trying different .NET versions of MgmtClassGen.exe. So I took that build option out.
I found a link to the redistributable for J#, it may work if that was installed.
It wouldn’t take much to put it back in or to just amend the argument string for the VJ for the type and the file extension using a different language version.
This program was built just for finding all files by exact filename only. So I could find all versions of the MgmtClassGen.exe file and sort by file version.
As you can see from the screenshot above, I found 4 different .NET File versions in various back up folder locations. Still, remember to use the correct version for the Bit Version of your OS.
In the screenshot below, I added a label to show the bit version of the Operating System you are running the program on as a reminder of what version to use (in case you are running this on an unfamiliar system).
By the Numbers
- Select a namespace
- Select a class
- Select the output language desired
- Select the location to output the file to
- Select the location of the MgmtClassGen.exe folder
- Click button to generate the full command line argument
- Right click and copy the full command line argument
- Click the button to open a command window to the location specified in step 6. It uses the location as an argument when opening the command window to that location. You can change locations for each .NET version without regenerating the command line arguments. You just have to open a new command window to the location for the version used.
- Paste the generated command line arguments and hit enter . If there are no problems, then above is what you will see. Otherwise, you see one of the next screenshots.
This happens when the command line arguments are wrong, when you specify a folder location on the desktop, or for some reason it is not supported. Top was from pointing the
MgmtClassGen at a location that did not contain the file. Bottom picture is from the Windows XP test.
If you want to generate several classes using the same .NET version of the MgmtClassGen.exe file, then just change the class and regenerate the command line arguments. You can generate several classes very quickly with this program.
If you would like to see what the classes are, then you can always use the Scriptomatic V2.0.
Remember though that there version only shows the Dynamic classes.
Direct link to download:
Or through the script center download link:
I will make my highly modified version of the Scriptomatic 2.0,
ClassNFOMatic22. “HTA” available at a later date. I’m still redesigning my script section on my web site. My version only supports VB, but it does list all classes.
There is not to much to the settings, just click on the label named Settings. It just saves the location for the output folder and the MgmtClassGen.exe folder locations. Pretty easy to use, at least I think so.
Testing The Application
- I tested this program on Windows Vista Ultimate 64 bit Quad Core (also the build system).
- Tested on Windows 7 Ultimate 64 Bit Quad Core (Dual boot)
- Windows 7 Professional 32 bit Single Core (older Laptop)
- VM Windows Vista Business 32 bit all worked but C++ would not work on VM
- VM Win XP Pro sp. 3 32Bit all worked but C++ would not work on a VM (Virtual Machine)
- I also found out through my onload event the XP version did support the
My.settings reference and I had to add error handling to the
onload event to take care of the runtime error that popped up.
So steer clear of VMs and XP for generating the classes.
1/29/2013 Removed Link to my website. Had to let site go.
Program updated to add a splash screen to take up the time for the on load while it is gathering the namespaces, so it does not appear unresponsive.
Also added the Zipfile for download thru here, Since my current download location may dissapear in May.
Current version is now 6.2 as of December 20 2011
If there are any questions, you can post here or contact me thru the send private email.
My first experience with computers was when my mom gave a Timex Sinclair 1000 to me for Christmas some time in the late 70's (I still have it)There I learned to copy code from magazines to save to cassette tapes for playing games.
Since then I have dabbled in:
Basic,Qbasic,ruby,python,Java Script, HTML, CSS, C#, C++, Perl, and a few other I can't think of off hand.
Now I Mainly work with VB Script and VB.Net
I Prefer to build programs that make use of the GUI so I don't have to remember all of the syntax for console apps. I realy don't care much for HTML because of the way you build and then run to see if it looks right. Also the new WPF is to much like HTML so I steer clear of it for now.
Most of what I build is for getting information from a system to use in system repair.I make heavy use of the WMI classes. Why reinvent something.