The hardware inventory agent, HrdWrInv.vbs, relies on Windows Management Instrumentation (WMI) to retrieve hardware inventory. The agent relies on the FileSystemObject (which is part of the Scripting Runtime Library) to detect existing inventory files, create new inventory files, and write lines of data to each inventory file.
The script's first line of code contains the On Error Resume Next directive, which is important because you don't want to bother users with any operational errors that the script might generate. Such errors typically occur because the network access for creating the inventory files is configured improperly or because the WMI Core components haven't been installed or aren't operational on the system.
After defining some constants and global variables, the script's WMI connection string connects to the local computer and uses the WMI SWbemServices object's ExecQuery method to run a series of queries. Each query runs semisynchronously to improve script performance, and the script packages each query's result in an SWbemObjectSet collection. This collection contains the queried computer's hardware properties, which the script then writes to an inventory file. (If you haven't heard much about WMI, consider reading "Windows Management Instrumentation: The Journey Begins," July 2000, http://www.winnetmag.com, InstantDoc ID 8959. This article is a good primer and contains references to additional material. Also, visit the Microsoft Developer Network'sMSDN'sWMI Scripting Primer series, beginning at http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112002.asp.) . . .