WMI Code Generator

Version 8.01

 

100% CLEAN award granted by Softpedia WMI-Code-Generator antivirus report at FileCluster.com

 

Use this HTA to generate Batch, C#, Delphi, F#, Java, JScript, KiXtart, Object Pascal, (Open) Object Rexx, Perl, PowerShell, Python, Ruby, VB .NET or VBScript code for menu selected WMI queries.
WMI Code Generator 8.01 Screenshot
Click "Configure" to make the settings appear, change them to your liking, click "Hide Settings" when done. These settings are not permanent. To make them stick, create a shortcut with the appropriate command line switches.
Pressing F1 displays a list of all command line switches available.
WMI Code Generator 8.01 Help Screen
Select a WMI namespace from the dropdown list, or stick with the default (root/CIMV2).
If a warning message, suggesting to abort the script, appears after selecting a namespace, click "No" to continue reading the list of available classes.
Warning message if the HTA temporarily uses too much resources.
Select a class.
The "Properties" and "Methods" fields will show the names of the properties and methods available for the selected class.

To get detailed information on a class or a method or property, select that class and method/property, and click the "MSDN Help" button.
This will open an Internet Explorer window with the relevant MSDN page, or if that page doesn't exist, a list of Google Search results.

Select a scripting or programming language from the drop-down list and click the "Generate Code" button to generate the code that will display all properties of the selected class, and their values, in the scripting or programming language of your choice.

To test the selected query on your own computer, click the "Run WMI Code" button and wait for the result to appear on screen. Click "Generate Code" once more to redisplay the code in the selected scripting language.

Then copy the code (or result) to the clipboard, and paste it into your favorite scripting editor.

After some optional "pruning", save your own custom WMI script or program code.
WMI Code Generator 8.01 Credits Screen
To view the credits screen, click the "Credits" button.

 

Change History

Version Release Date
(yyyy-mm-dd)
Changes
8.01 2013-05-23 Bug fixed by Aaron Mason in generated VBScript code.
8.00 2012-11-15 Added Delphi and Object Pascal to the list of supported languages.
Replaced (most of) the "legacy" HTML code by HTML/CSS code, fixed some HTML/CSS errors, and included a document type, to make the HTA work in Internet Explorer 10/Windows 8.
7.03 2011-08-16 Added Java to the list of supported languages.
Fixed a bug that would sometimes disable the "Generate Code" and/or "Run Code" buttons.
7.02 2011-08-11 Added a command line switch /CLASS:"class" to select the class the HTA opens with.
Added a command line switch /LANGUAGE:"language" to select the language the HTA opens with.
Added a command line switch /GENRATE to immediately generate the code for the selected namespace and class in the language of choice (requires /NAMESPACE, /CLASS and /LANGUAGE).
Added a command line switch /RUN to immediately run the generated (VBScript) code for the selected namespace and class (requires /NAMESPACE and /CLASS).
Added a command line switch /FAST to skip the queries to populate the namespaces and classes lists, and populate these lists with the selected values only (requires /NAMESPACE; /CLASS is optional, if not used, the list will still be populated using a WMI query).
Added a command line switch /COPY to copy the generated code or query results to the clipboard and close the HTA (requires /NAMESPACE, /CLASS and either /LANGUAGE and /GENERATE or /RUN); this allows the HTA to be run without interaction; use Paste.exe to read the results from the clipboard.
To prevent incorrect update notices, the update check now clears the Internet Explorer cache and rereads the latest version from the web (once) if it does not match the current version.
Some command line examples were added to the help text.
The help text has been moved to an Internet Explorer window, because it exceeds the maximum MsgBox message length.
7.01 2011-08-07 Fixed a bug in the MSDN Help function.
7.00 2011-08-06 Added a dropdown list to select alternative WMI namespaces, besides the default root/CIMV2.
Added a command line switch /NAMESPACE:"namespace" to select the default namespace the HTA opens with.
Added a checkbox in the settings to hide the update notification.
"Generate resource-friendly code" now affects more script languages (all but batch and the "true .NET languages").
Fixed a bug that could disable the "Generate Code" button after changing the "Generate resource-friendly code" setting.
Fixed, optimized and rewrote the routine that inserts spaces in property names.
6.24 2011-07-30 Fixed a bug in the handling of the /WRAP switch.
6.23 2011-07-30 Added an option (settings and command line switch /RESOURCEFRIENDLY) to restore the previously removed WQL and wbemFlagReturnImmediately + wbemFlagForwardOnly parameters in the generated ExecQuery statements for JScript, KiXtart, Perl and VBScript; using these parameters makes the WMI query results "read-once" and renders the .Count property useless, but the generated code will use less resources.
Added a choice to enable or disable (soft) word wrap in the code screen (settings and command line switch /WRAP).
6.22 2011-07-25 Removed the second and third parameter (WQL and wbemFlagReturnImmediately + wbemFlagForwardOnly) in the generated ExecQuery statements for JScript, KiXtart, Perl and VBScript.
Thanks for Steve Robertson who found out that not using these parameters actually improves the code: you can now use the .Count property of the collection that ExecQuery creates, and reiterate through that collection as many times as you like.
6.21 2011-06-14 Generated Ruby code will now accept an optional remote computer name as command line argument.
6.20 2011-06-14 Improved Python code, it now works with Python 3.1 and handles properties of every type.
Improved VB .NET code, it now complies to Visual basic 2010.
Generated C#, Python and VB .NET code now accepts an optional remote computer name as command line argument.
The configuration settings are now hidden behind the new "Configure" button.
Spaces in property names (in the generated source code) are no longer inserted by default.
Added the following switches:
/SPACES    insert spaces in property names (in generated source code)
/SIZE:widthXheight   specify window size
/HELP and /?   display command line help, also available by pressing F1
/NOUPDCHK   skip check for updates at startup
6.11 2011-05-19 Improved F# code, it will now handle properties of every type.
6.10 2011-05-19 Added /NOSPACES and /Q switches, and interactive settings.
With /NOSPACES the original property names will be used for descriptions, otherwise the descriptions will contain spaces to improve readability.
If no command line switch is used, a settings block will appear at the top of the page, allowing to interactively change the settings otherwise controlled by the command line switches.
With /Q the settings section will remain hidden.
6.00 2011-05-19 Added F# to the list of supported languages.
5.10 2010-10-08 Added /WIN32 and /NOPERF switches, removed /ALL switch.
By default, all classes in the ROOT\CIMV2 namespace are listed at startup.
With /WIN32 only Win32_* classes are listed.
With /NOPERF Win32_Perf* classes are excluded from the list.
5.00 2010-06-30 Added C# (assisted by my son Bas) and VB .NET to the list of supported languages.
4.10 2010-06-28 Added Ruby to the list of supported scripting languages.
4.01 2010-06-28 Corrected the URLs to my own site.
4.00 2010-06-28 Added a "Run WMI Code" button to test the selected WMI query.
3.00 2010-06-27 Replaced "Create ... Code" buttons by a drop-down list.
Optimized screen layout for large and small screens.
2.02 2010-01-25 Added doublequotes for the "node" name in the generated batch code, to prevent error messages if the computer name contains dahes (problem discovered and solved by David Chisholm).
2.01 2008-07-20 Corrected the URL to WMIGen.hta in the generated code.
Added alternating background colors in the dropdown list boxes.
2.00 2008-07-16 Added a "Help" button, which searches MSDN for a relevant reference page for the selected Class, Method or Property. To write the help function, this article from Search Engine Roundtable proved invaluable.
The properties and methods are no longer listed in HTML text areas, but in dropdown lists.
1.33 2006-10-20 Added BREAK ON statement in generated KiXtart code, to close all running processes when Ctrl+Break is pressed.
Thanks for Senser for this tip.
1.32 2006-10-16 Added /ALL command line switch to display not only Win32_* classes, but all classes.
1.31 2006-09-11 Corrected an error in the generated JScript code.
1.30 2006-09-08 Now also generates Batch, Object Rexx, Perl and Python code.
Added the script language name in the comment lines of the generated code.
1.21 2006-09-05 Generated KiXtart and PowerShell script now support command line specified remote computer name.
1.20 09/05/2006 Besides PowerShell and VBScript, now also generates JScript and KiXtart code.
Added an empty line in the generated scripts, to distinguish between object instances.
Added a "Clear Code" button.
1.14 2006-08-30 Minor update: improved update/version check.
1.13 2006-08-21 Improved update/version check.
Added comments to the generated scripts.
1.12 2006-08-18 Improved window layout for low resolution displays.
Text areas are now resized when main window is resized.
Dynamic tool tip for "Copy Code" button.
1.11 2006-08-16 Added tool tips.
1.10 2006-08-15 Added automatic update check & notification.
Added background gradient.
1.00 2006-08-14 Initial version.

 

Download WMI Code Generator 8.01:

 

Checksums:
File name:
MD5:
SHA1:
 
wmigen.zip
e3a85f6987175863b23e5ae0ca1e0af3
4215eae4096d129170a5dc5a0e60e50423dca2c9

 

Make a donation:

page last uploaded: 23 May 2013, 19:44