Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


June 09, 2003

Home-Brewed Hardware Inventory

Create a full-bodied hardware inventory report from just a few simple ingredients
RSS
View this exclusive article with VIP access -- click here to join |
See More Windows Management Instrumentation (WMI) Articles Here | Reprints | Or sign up for our VIP Monthly Pass!
SideBar    How the Inventory Agent Works, How the Report Agent Works

Analyzing the Data
After inventory collection is complete, you can review individual inventory files in Notepad. Each text file contains sections, such as ComputerSystem and IDEController, that represent a characteristic of the inventoried computer. Not every inventory file contains every section, however. For example, if you inventory a computer that contains a SCSI controller but no IDE controller, the corresponding file will contain a SCSIController section but won't contain an IDEController section.

Also, a system's OS version will affect the amount of hardware that the inventory file displays. For example, a Win98 system's inventory file won't contain a PhysicalMedia section because the Win32_PhysicalMedia WMI class is available only on Windows 2003 or XP machines.

Within the available sections, you might notice some items with values listed as Not available. This value occurs when a hardware manufacturer hasn't stored data for a particular WMI property or when WMI can't locate a property's value. . . .


Already a VIP member?
Please log on to view the full article

Why become a VIP member?

VIP-only online access
VIP CD delivered twice a year: offline access to the entire Windows IT Pro article library
Monthly issue of your choice of Windows IT Pro or SQL Server Magazine

Subscribe Now
Reader Comments
<P>Great article but since the most important part in an inventory is the serial number, is there a way to get the serial number of the PC?<B>--Don</B></P>
<P>If you want the serial number look at the IdentifyingNumber property of Win32_ComputerSystemProduct. Works on most computers built since 2001. Older computers may or may not report their serial number.<B>--Bill Schalck, April 19, 2004</B></P>

Don August 07, 2003


<P>Great code and just when I needed it!</P>

Martin August 14, 2003


<P>When I run the inventory script against my PC, I get this error, which occurs after OSInformation, ComputerSystem, PageFileSetting, and PhysicalMemoryArray have been recorded in the .txt file:</P>
<BR>
---------------------------<BR>
Windows Script Host<BR>
---------------------------<BR>
Script: C:\Documents and <BR> Settings\JeffV\Desktop\Hardware<BR> Inventory\HrdWrInv.vbs<BR>
Line: 154<BR>
Char: 3<BR>
Error: 0x80041001<BR>
Code: 80041001<BR>
Source: (null)<BR>
<BR>
---------------------------<BR>
OK<BR>
---------------------------<BR>
<BR>
<P>The line that errors out is this one in the QueryInstances subroutine:<BR>
<BR>
<DD>For Each objComponent in objClassName</P>

Jeff August 17, 2003


Hi!
Just wanted to make a small remark concerning the code:

<P>First HrdWrInv.vbs, line 93 reads:<BR>
<BR>
If Mid(intVersion,1,3) >= 5.1 Then<BR>
<BR>
This should read:<BR>
<BR>
If Mid(intVersion,1,3) >= "5.1" Then<BR>
<BR>
or the script would not run on my WinXPPro.</P>

<P>Second, in BuildReport.vbs, line 295 reads:<BR>
<BR>
RenameSheets "Sheet" & i,WBName<BR>
<BR>
My Norwegian Office calls these sheets "Ark", and this script didn't run either, until I corrected this.</P>

Thomas Hansen September 11, 2003


<P>This was very helpful in a bind. Code works well. Easy to read and modify!</P>

Scott October 22, 2003


<P>I really enjoyed this article about the hardware inventory. It will probably get lots of use here. I have been looking for this exact code. We've been using a third-party software package for this, but since we've upgraded our security, that package no longer works.</P>
<P>I do have a few questions, though: What code should I put in if I want to collect the username on the Computer Systems tab in the Excel report? What needs to go in the hardware script AND what should I put in the report generator?</P>

<P><B>A note from Ethan: </B>The Computer Systems tab is populated with information from the Win32_ComputerSystem class. In this class, there are two additional properties that will probably provide you with what you're looking for: UserName and PrimaryOwnerName.</P>

<P>In hrdwrInv.vbs, you need to add these two properties to the strProperties variable for Win32_ComputerSystem. You'll see the properties listed on lines 64 - 66. In buildReport.vbs, you need to add column heads for the two new properties. The column heads are specified for Win32_ComputerSystem on lines 49 and 50.</P>


Carl Klima January 22, 2004


This is going to work well for us. I modified a bit to get the UserName and SerialNumber. Now just to make it automatically run on all computers on the domain......

Craig March 25, 2004


<P>I was trying to get the SerialNumber property from the bios and entered the property in Line 133 in HrdWrInv.vbs and added the property on line 97 of the buildReport.vbs. The info is collected in the text file but doesn't show up in the Excel report. Did i omit something?</P>

Jean-Claude May 06, 2004


<P>This is great. I have been reading up on the WMI classes and was trying to pull the network settings (ipaddress/DNS/GW, etc) but it always gives me errors. Any thoughts? I would also like to grab some software info. Is there an easy class that has the SW listed in ADD/remove only? What about hotfix/updates? Thanks for the great script!</P>

Bill Prochazka May 18, 2004


On Windows 2000 Pro i have got thi error:
---------------------------
Windows Script Host
---------------------------
Script: C:\Documents and
Settings\Tommaso\Desktop\HrdWrInv.vbs
Line: 154
Char: 3
Error: 0x80041001
Code: 80041001
Source: (null)

---------------------------
OK
---------------------------

I have already try to update to version 5.6 of scipt engine but i have got it again. What i can do to solve the problem

Tommaso July 05, 2004


 See More Comments  1   2   3 

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Related Articles System Inventory Mini-App

Scripting Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events The Easiest Way to Save Time and Money on E-mail and SharePoint Management

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement