Exchange Geek's Weblog

I'm a Geek!

Finding Windows Server Versions and Editions in Active Directory

Posted by Milind Naphade on 27/04/2011

I came across this requirement at one of my customer’s environment. They have a huge network of Windows Server systems and do not have any details of their Windows Servers in Active Directory. Unfortunately, Active Directory stores very limited information with Computer accounts so it becomes necessary to logon to each computer and then find out this information. In our case we had more than 350 servers which made it even more difficult. Computers running Windows Vista and later and Windows 2008 and later will add their server edition details with their computer accounts in active directory as well but for the operating systems earlier to Windows 2003 and XP it becomes a trouble.

I prefer using Quest AD cmdlets while working with AD objects because they save a lot of time and lines of code. I have used it one more time here and here is the script that worked for us:


$objComputers = Get-QADComputer -SizeLimit 0 -IncludeAllProperties | Where-Object {$_.OperatingSystem -like "Windows Server *"} | Select-Object dnshostName

foreach ($objComputer in $objComputers)

    if (Test-Connection -ComputerName $objComputer.dNSHostName -Count 1 -ErrorAction SilentlyContinue)
    $WMIResult = Get-WmiObject Win32_OperatingSystem -ComputerName $objComputer.dNSHostName -ErrorAction SilentlyContinue
    Write-Host $objComputer.dNSHostName ":" $WMIResult.Caption
    Write-Host $objComputer.dnsHostname "is not reachable"

Here is the output of the script:


Please note: you need Quest Active Directory Management Cmdlets installed on the computer where you run this script from.


Sorry, the comment form is closed at this time.

%d bloggers like this: