Introduction
As a system administrator, one of the responsibilities is to keep accurate an server inventory. To do it manually would be hard, it would be always out-of-date, and contain errors. To do a server inventory with more the 30 servers is a nightmare.
I have looked for a tool to build a server inventory years ago, with the following features, but I had no luck.
- It is able to collect all server information in one shot, and remotely.
- It does not require to install anything in all servers.
- It does not require scripting skill.
- It collects data quickly.
- Its result in tabular format so the result can be easily manipulated by Excel.
- It is free.
Until one day. I had a troubleshooting case where an engineer requested that I collect server information with a Windows out-of-the-box command. I dug into the command and found it could accomplish the requirements I listed above. The utility is systeminfo.exe.
How to Get a System Inventory?
I will show you step by step how the tool is going to work. Finally, build your own system inventory, in CSV format.
1. To capture current server information, run the command in command prompt:
systeminfo.exe
It prints following server information:
Host Name: MyPC
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 3 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: An User
Registered Organization: An Organization
Product ID: 12345-678-1234567-12345
Original Install Date: 1/1/2010, 12:00:00 aM
System Up Time: N/A
System Manufacturer: xyz
System Model: xyz
System type: X86-based PC
Processor(s): 1 Processor(s) Installed.
[01]: x86 Family 6 Model 23 Stepping 10 GenuineIntel ~2394 Mhz
BIOS Version: xyz 12345678
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi
Total Physical Memory: 3,024 MB
Available Physical Memory: 2,434 MB
Virtual Memory: Max Size: 2,048 MB
Virtual Memory: Available: 2,007 MB
Virtual Memory: In Use: 41 MB
Page File Location(s): C:\pagefile.sys
Domain: xyz.COM
Logon Server: \\xyz
Hotfix(s): 158 Hotfix(s) Installed.
[01]: File 1
...
[82]: KB973540_WM9
[83]: KB954154_WM11
[84]: KB941569
[85]: MSCompPackV1 - Update
[86]: KB898461 - Update
...
NetWork Card(s): 2 NIC(s) Installed.
[01]: Wireless WLAN Mini-Card
Connection Name: Wireless Network Connection
DHCP Enabled: Yes
DHCP Server: 192.168.1.1
IP address(es)
[01]: 192.168.11.2
[02]: Gigabit Network Connection
Connection Name: Local Area Connection
Status: Media disconnected
2. To capture a remote server information, add the parameter "/s servername":
systeminfo.exe /s ServerName
This shows remote server information. It is the same information that is captured on a local machine.
3. To save the result into a CSV format, into a file, add a parameter "/FO CSV", and redirect it into a file by "> filename":
systeminfo.exe /s ServerA /FO CSV >Systeminfo.csv
A CSV file "Systeminfo.csv" with heading labeled is generated.
4. To output the result without column heading, and appending the output by ">> filename":
systeminfo.exe /s ServerB /FO CSV /NH >>Systeminfo.csv
5. Put it all together into one batch file with following lines:
systeminfo.exe /s ServerA /FO CSV >Systeminfo.csv
systeminfo.exe /s ServerC /FO CSV /NH >>Systeminfo.csv
...
systeminfo.exe /s ServerX /FO CSV /NH >>Systeminfo.csv
A sample result in CSV format, opening it with Excel.
In my environment, each server took less than 10 seconds to collect the system information and 100 servers information can be retrieved in less than 30 minutes.
It works in Windows XP, Windows Server 2003, and Windows Server 2008 and Windows Server 2008 R2.
Lastly
One day your manager come to your desk and ask you the questions,
- How many machines are in win 2K3 sp2?
- How many machines have less than 4GB memory?
- How many machines have KB123456 installed?
You can simply refer to the CSV system inventory, and using Excel's auto-filter feature to find it out easily, with accurate and solid answer in less than 5 minutes.
Try yourself and get a latest & accurate server inventory now!