• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

How to determine which version of Windows is running on PC's in our domain environment?

hi guys

We have around 150 PC's on a particular domain. We wanted to basically obtain the list of PC's which are on Windows XP and those which are on Windows 7 by extracting the information from AD?

The domain controller where all this information sits is a Windows 2003 server, so I don't have powershell sadly to run queries.

Any help would be great.

Thank you
  • 2
  • 2
  • 2
  • +3
4 Solutions
Muhammad MullaCommented:
There is a vbscript posted here that should work.
Bill PrewCommented:
Guy LidbetterCommented:
You could use LDIFDE (for txt file) or CSVDE (For csv file)...

ldifde -f output.txt -r "(&(objectClass=computer)(operatingSystem=Windows XP*))" -d "dc=mydomain,dc=com" -p subtree -l "cn,operatingSystem"
csvde -f output.csv -r "(&(objectClass=computer)(operatingSystem=Windows XP*))" -d "dc=mydomain,dc=com" -p subtree -l "cn,operatingSystem"

Just change (operatingSystem=Windows XP*) to (operatingSystem=Windows 7*) for windows 7 machines... I couldn't rememer how to get it to do an OR... alternatively use (operatingSystem=Windows*) and just filter the CSV in excel....
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

If psexec is ok for you...
psexec \\* cmd reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"

Open in new window

This assumes the remote registry service is on at the stations.
Steve KnightIT ConsultancyCommented:
I was going to suggest extracting from AD yesterday for ease but can see Guy has done that for you.  If you just want all computers/servers extracted then you can load into excel and analyse just remove the filter on OS.. though that will also pull up old computer you haven't deleted from AD too though.  This is just Guy's command minus the filter:

csvde -f output.csv -r "(&(objectClass=computer))" -d "dc=domain,dc=local" -p subtree -l "cn,operatingSystem"

Open in new window

I also use the VBScript below to write on login using GPO login script, or whatever script you currently run to the structure like this for a basic audit:


So you can see then text files for each computer, each user, day, and OS when people login.
The Admin dirs fill up with who is local admin of each PC and which PC's a user is local admin of.
The hardware file makes a basic audit of hardware information.

You just need to amend the path it writes to at the top of the script to be the base directory and all users will need write access to that shared area.

Steve KnightIT ConsultancyCommented:
The logs made there btw look along the lines of this, same information in a file for each day, os, pc name, and user.

2015-03-24 22:31:24 - ® Windows Server® 2008 Standard SP2 - FS1 - administrator
2015-03-24 22:32:52 - ® Windows Server® 2008 Standard SP2 - FS1 - administrator
2015-03-24 22:37:13 - Windows 2000 Server SP4 - CS1 - administrator

Open in new window

Name: PC009
Manufacturer: System manufacturer
Model: System Product Name
Serial Number: System Serial Number
BIOS Version: 9012
BIOS Date: 10/29/2012
Operating System: Microsoft Windows 7 Professional 
OS Service Pack: Service Pack 1
Physical Memory: 7885.98
HDD Size: 465.75
Processor: Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
CPU Current Clock Speed: 1584
Available space: 391.52
MAC Addresses: 50:46:5D:90:A5:BE,50:46:5D:90:A5:BE
IP Addresses:,fe80::441b:690e:14:6d38
Network: Outside
User: my.name
User domain: DOMAIN
Network: Outside
Word version: 14.0

Open in new window

Guy LidbetterCommented:
AH I have it!!! the OR operator is a pipe ('|')... The script is now ALL XP and W7 desktops....

csvde -f output.csv -r "(&(objectClass=computer)(|(operatingSystem=Windows XP*)(operatingSystem=Windows 7*)))" -d "dc=domain,dc=com" -p subtree -l "cn,operatingSystem" -s <DomainController>

Open in new window

YashyAuthor Commented:
haha....awesome man. You got there in the end:).

Guys, thank you for your help.

Every single one of them was helpful.

I've managed to run Guy's and Steve's script too and got the information.
Thanks for the update, Yashy. Much appreciated. Have a good weekend.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now