Display System and BIOS Configurations

Here’s a set of HTAs that use VBScript code and WMI to retrieve OS, startup, and BIOS information from the local computer.

Readers

March 12, 2006

2 Min Read
ITPro Today logo in a gray background | ITPro Today


HTML Applications (HTAs) are standalone applications that work on Windows OSs with Microsoft Internet Explorer (IE) 5.0 and later. Double-clicking an .hta file runs it like any other executable. HTAs use the IE engine to render the application's menus, buttons, and so on. However, HTAs don't use IE's UI. With HTAs, you design the UI. (For an introduction on how to design HTA UIs, see "Hooked on HTAs," August 2005, InstantDoc ID 46795.)

In HTAs, you can use JScript or VBScript code and such technologies as Windows Management Instrumentation (WMI). I created a utility that uses VBScript code and WMI to retrieve OS information from the local computer. This utility is composed of four files: winutil.hta, winstup.hta, winosys.hta, and winbios.hta. Winutil.hta launches the other three .hta files. You can download the four files from the Windows Scripting Solutions Web site: Go to http://www.windowsitpro.com/windowsscripting, enter 49363 in the InstantDoc ID text box, then click the 49363.zip hotlink.

To install the utility, create a folder on your hard disk and place all the .hta files in it. Double-click the winutil.hta file to obtain the utility's menu, which Figure 1 shows. When you click the Display startup command option, winstup.hta executes and you receive information about the startup commands on the local computer. When you click the Operating System option, winosys.hta runs and you get information about the computer's OS. When you click the Bios option, you receive BIOS data. The menu contains only three items but is designed so that you can easily add other items. For example, suppose you want the utility to display information about the local machine's running processes. In winutil.hta, find the code

‹LI›‹a href="#" on Click="runhta   ('winxxxhtaa')›Opt #4‹/a›

In this code, replace Opt #4 with an appropriate description (e.g., Running Process) and replace winxxx.hta with the name of the HTA you'll create to display the active processes (e.g., winprocess.hta). You can use winosys.hta as an example of how to write the winprocess.hta file. If you're unsure of the WMI class to use, you can go to the WMI Classes Web page at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_classes.asp. For winprocess.hta, you'd use the Win32_Process class. You can use the utility to do hardware and software inventory on a computer farm. To retrieve the characteristics of a remote computer, you need to change one line in the winstup.hta, winosys.hta, and winbios.hta files. Change the line

strComputer = "." 

to

strComputer = "remote_computer" 

where remote_computer is the remote computer's hostname (e.g., host0001). You must have the rights to execute the HTA on a remote computer. Note that an HTA can contain malicious code, so run only your HTAs in your computer farm.

The utility runs with Windows Scripting Host (WSH) 5.6 and later on Windows 2000 Server, Windows 2000 Professional, and Windows XP.

—Magni Mauro

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like