Updating System Inventory Databases


\[Editor's Note: Share your scripting discoveries, comments, problems, solutions, and experiences with products. Email your contributions (500 words or less) to [email protected] We edit submissions for style, grammar, and length. If we print your submission, you'll get $100.\]

My company has a large system inventory database that often needs updating and correcting. Manually checking more than 75 servers is tedious, so I wrote the SystemInventory.vbs script to obtain system information about servers in our environment. Listing 1 shows an excerpt from SystemInventory.vbs. You can download the full script from the Windows Scripting Solutions Web site. (Go to http://www.windowsitpro.com/windowsscripting, enter 45824 in the InstantDoc ID text box, then click the 45824.zip hotlink.)

As Listing 1 shows, SystemInventory.vbs uses Windows Management Instrumentation (WMI) to report on more than 400 system objects from 11 Windows classes: BIOS, BootConfiguration, ComputerSystem, ComputerSystemProduct, DiskDrive, DiskPartition, DisplayConfiguration, NetworkAdapter, NetworkAdapterConfiguration, OperatingSystem, and Processor. The script creates a Microsoft Excel worksheet that contains important information from each of these classes. SystemInventory.vbs saves the Excel spreadsheet that it creates to C:\~COMPUTERNAME.xls, where COMPUTERNAME is the name of the computer you're querying. The script requires Excel on the computer from which you run the script and WMI on the system you're checking. (Windows 2000 and later includes WMI.)

SystemInventory.vbs uses a simple Web input form that accepts the server's name, user credentials (i.e., Domain\UserID), and a masked password. Listing 2 shows the code for this form. You can use the IP address instead of the server name if name resolution is unavailable. If you need to authenticate to another domain or need to use different credentials, enter the domain name, a backslash, and the user ID and associated password. Otherwise, just enter the server name or IP address and click OK. If you leave the server name blank, SystemInventory.vbs queries the local machine.

You need Administrator rights to run SystemInventory.vbs. In addition, SystemInventory.vbs and SystemInventory.htm need to reside in the same folder. To stop SystemInventory.vbs from running, click the X on the Web input form's title bar to close the form. SystemInventory.vbs includes minimal error-checking code; if the computer that you're querying doesn't exist or doesn't have WMI installed, the script ends.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.