Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Instead of typing this in a command prompt one at a time:

wmic /node:ipaddress /user:administrator /password:mypassword bios get serialnumber

How can I run that against one entire subnet and output to a text document? Since I do this every couple months to verify our inventory of computers, I would assume there would be a much of easier way I could put this in a batch script instead of doing it manually.

share|improve this question
up vote 4 down vote accepted

You may put a list after node: node:ip1,ip2,ip3, or use a file node:@file - so just put all your ip addresses into a file and then run:

wmic /node:@nodes.txt /user:administrator /password:mypassword /output:out.csv bios get serialnumber /format:csv

That assumes user/password is the same on all machines.

share|improve this answer
Is there a way to list any consoles in the output file that failed? Response I get from some is "RPC unavailable" or something like that, I want to know which ones I have to go back and check because of that. – C-dizzle Oct 12 '12 at 19:12
@C-dizzle You could redirect stderr to file eg. with ` 2>log.txt` (you may add it before wmic or append at the very end of cmdline and then analyze that. You may also want to add /failfast:on – wmz Oct 12 '12 at 19:31
I must not be doing that part right, can you give me an example on how to append that to my command? – C-dizzle Oct 12 '12 at 19:58
2>log.txt wmic /node:@nodes.txt /user:administrator /password:mypassword /output:out.csv bios get serialnumber /format:csv or wmic /node:@nodes.txt /user:administrator /password:mypassword /output:out.csv bios get serialnumber /format:csv 2>log.txt (both should be single lines) – wmz Oct 12 '12 at 20:03

A for loop with a file redirection will work, although you might want to let it sit and run for a while if you have more holes in your node set (in otherwords, can't resolve the IP in the loop)

(FOR /L %s IN (1,1,254) DO wmic /node:192.96.1.%s /user:administrator /password:pass bios get serialnumber) >> c:\results.txt

If you plan to put this in a batch file, replace the %s with %%s. That is all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.