Have you ever needed to gather system information from remote machines and wish you had a sweet script or batch file to do it? I happened to have one!
It’s an easy one, Keep It Simple Stupid (KISS) right?
What you’ll need:
- sysinfo.exe (which I bumped into on Windows XP in some service pack directory)
- Text file of machines you want to query
You can find sysinfo.exe in “C:\Windows\ServicePackFiles\i386”, for the list of machines to query it’s all you!
Here’s what to do:
Put your sysinfo.exe and pclist.txt files in a directory anywhere on your computer. Open a command prompt, Start > Run > CMD > OK. Navigate to the directory with sysinfo.exe and your text file in it.
Type: for /f %i in (pclist.txt) do sysinfo /S %i /U %i\administrator /P “your local admin password can have spaces” /FO CSV >>PClist.csv
What this does is “for” every line in your text file (computer1, computer2, etc) it calls the sysinfo.exe command to get the system information of a particular system, i.e. /S %i. By using our “for loop” we tell it to iterate through the file repeating our system information request on as many machines as we’ listed in the text file. Our command continues executing on each line then it appends the result “>>” to a CSV file we can then open with Excel or manipulate in other ways.
/S is system, specifying the REMOTE system connection
/U is our credentials, domain\username OR as we did %i\username, we used the local administrator account!
/P is our password, it’s plain text here people so don’t type this while Joe Shmoe is looking over your shoulder!
/FO is our format, we specified a CSV but you also have “TABLE” and “LIST” which might be helpful.
You should get output that has great information in it. The stuff I was looking for were host-name, OS, a hardware vender like Dell, HP, etc what type of processor it has, the up-time is great to have, how many processors it has (class of processor) and the service pack level. It’s an easy way to run a quick audit because it also lists the patches you have installed, it doesn’t hurt to take a quick look at them.