Friday, November 18, 2005

Management Strongly Typed Class Generator (Mgmtclassgen.exe)

Management Strongly Typed Class Generator (Mgmtclassgen.exe)

"The Management Strongly Typed Class Generator enables you to quickly generate an early-bound managed class for a specified Windows Management Instrumentation (WMI) class. The generated class simplifies the code you must write to access an instance of the WMI class."

Saveen Reddy points out the cool .Net utility called Mgmtclassgen.exe.

Mgmtclassgen will create a C#, VB, J# class for a given WMI Class. What's cool is that the class is also instrumented with description attributes about a given property.

Looks like this could make WMI easier and more approachable...

"mgmtclassgen Win32_LogicalDisk /l VB /p c:\disk.vb"

Here's a snip...

<Browsable(True), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), _
Description("The Compressed property indicates whether the logical " & _
"volume exists as a single compressed entity, such as a DoubleSpace" & _
"volume. If file based compression is supported (such as on NTFS), " & _
"this property will be FALSE."), _
TypeConverter(GetType(WMIValueTypeConverter))> _
Public ReadOnly Property Compressed() As Boolean
Get
If (curObj("Compressed") Is Nothing) Then
Return System.Convert.ToBoolean(0)
End If
Return CType(curObj("Compressed"), Boolean)
End Get
End Property

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...