Have a busload of servers? Need to know what version of Windows they’re all running?

Last Updated on April 24, 2017 by Dave Farquhar

Every once in a great while, I have to answer a question like what version of Windows a range of servers is running. If the number of servers is very small, you can just connect to them with a Terminal Services client and note what comes up. But sometimes that’s impractical. Right now I’m working someplace that has 8,000 servers, more or less. I’m not going to check 8,000 servers manually. I’m just not.

Here’s a more elegant, much faster way to go about getting that information.

It’s surprisingly easy, really–a one-line batch file can do the trick:


For /f %%x in (‘type servers.txt’) do @wmic /node:%%x os get csname,name | find “Windows” >>servers-version.txt

Simply enter the server names or IP addresses in a text file named servers.txt. The output is a file called servers-version.txt which will list the name of each server, the version of Windows, and some extraneous information about its system drive, one server per line.

Once you have the data in a text file, you can manipulate it further. Perhaps you need to find out how many Windows 2000 or 2003 servers that nobody ever got around to replacing. Or perhaps you’re one of those proactive organizations replacing Windows 2008 servers before support ends so you don’t end up like those people who still have Windows 2000 hanging around. Well, when you have all that information collected in a plain text file, you can answer questions like that in a matter of seconds, whether you have 50 servers or 8,000.

I found myself needing to know how to do this last week, and the last time I had to be able to do it was in 2007 or 2008. But there aren’t many who know how to remotely determine Windows server versions in large quantities from a batch file or the command line, so it’s a good skill to have.

I’ve collected most of my scripting resources in a single post about scripting Windows sysadmin tasks.

If you found this post informative or helpful, please share it!