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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad MullaSystems AdministratorCommented:
There is a vbscript posted here that should work.
Bill PrewIT / Software Engineering ConsultantCommented:
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....
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

NVITEnd-user supportCommented:
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 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.
NVITEnd-user supportCommented:
Thanks for the update, Yashy. Much appreciated. Have a good weekend.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.