Strong Type Gen – MgmtClassGen.exe Command Line Builder

This is a program I completed 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.

StrongTypeGen5.8.0.8

Before any selections or locations saved.

Current Version as of  10/16/2011 is 5.8.2.8

The Build:

This program was initially started on Windows  XP Pro 32 bit but was completed on Windows Vista 64 Bit version In Visual studio 2008. Written Entirely in VB.net

This Program is a stand alone program, no install required. Just unzip an go.

Minimum requirements is .NET version 2.0

File Size is 146 KB

The idea for the name space / class list layout was actually inspired by the Microsoft Scripting Guys Scriptomatic 2.0 , where I modified it to be able to view every name space and  class not just the dynamic ones. Then Adapted the idea for this program.

Links:

Download Location for the Current Version of this program.

Known issues:

Builds of the strong type classes seem to fail if you choose an output folder away from the root (C:\Saved_Classes) 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 on 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 screen shot below).

The program takes a few seconds to start up after clicking the the program icon to find all of the name spaces.

When there are a lot of classes to load it can take a few seconds to load the classes in the list box. My system will load about 1011 cimv2 classes into the list box , So just wait till the count is up and then its 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.

Found a link to the redistributable for J# , It may work if that was installed.

 http://msdn.microsoft.com/en-us/vjsharp/bb188598

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.

MgmtGenVerFound

This program was built just for finding all files by exact filename only. So I could find all version of the MgmtClassGen.exe file and sort by file version. Link to my site For this program.

As you can see from the screen shot 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 Screen shot 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 (Incase your running this on a unfamiliar system).

The Program :

mgmtclassallselected-b

By The Numbers :

1: Select a namespace

2: Select a class

3: Select the output language desired

4: Select the location to output the file to

5: Select the location of the MgmtClassGen.exe folder

6: Click button to generate the full command line argument

7: Right click and copy the full command line argument

8: 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 with out regenerating the command line arguments. You just have to open a new command window to the location for the version used.

mgmtclass3b

9: Paste the generated command line arguments and hit enter . If there are no problems , then above is what you will see. Other wise you see one of the next screen shots.

mgmt2.0.507277.42

MgmtClassErrorXP1Crop

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 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 quick with this program.

If you would like to see what the classes are then you can always use the Scriptomatic V2.0

Remember though there version only shows the Dynamic classes.

Direct Link to download here:

 http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&id=12028

Or thru the script center download link:

http://technet.microsoft.com/en-us/scriptcenter/dd772288.aspx

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.

Settings:

MgmtClassSettings

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 the C++ Would not work on VM

VM Win XP Pro sp. 3  32Bit all worked but the C++ Would not work on a VM ( Virtual Machine)

I also Found out thru my on load event the XP version did support the My.settings reference and I had to add error handling to the on load event to take care of the runtime error that popped up.

So steer clear of VM’s and XP for generating the classes .

If there are any question you can post here or

contact me at my pcsxcetra@consolidated[.]net 

(remove the brackets)

Edit: 09/04/2017 Removed links to sit I no longer have.

Advertisements

About pcsxcetrasupport3

My part time Business, I mainly do system building and system repair. Over the last several years I have been building system utility's in vb script , HTA applications and VB.Net to be able to better find the information I need to better understand the systems problems in order to get the systems repaired and back to my customers quicker.
This entry was posted in CodeProject, Programming, Programming Tools, VB.net and tagged , , , . Bookmark the permalink.