
This powershell script will allow you to get a list of your domain controllers and their operating system versions. This script uses information stored in the Active Directory database using the cmdlet get-adcomputer
$list = (Get-ADForest).GlobalCatalogs $domainnames = (Get-ADForest).Domains $domainnames_arr = $domainnames| % { $domname = $_ "$domname;" + (($_.split(".") | % {"DC=" + $_ }) -join "," ) } $DCarray=$domainnames_arr | % { $myADobjects = New-Object System.Object $dn = $_.split(";")[1] $dns = $_.split(";")[0] Get-ADComputer -SearchBase "OU=Domain Controllers,$dn" -server "$dns" -Properties OperatingSystem -filter * | ` select DNSHostName,name,@{l="Domain";e={$dns}},OperatingSystem, @{l="OS Name";e={((($_.OperatingSystem).split(" ")[0..2]) -join " ")}} } $DCarray
My Powershell script categories
- Active Directory
- Cluster
- Database
- Exchange
- Files and folders
- Hardware
- Network
- Operating System
- PKI
- SCCM
- Service and process
- Tips
- VMWare
List domain controllers forest wide with OS version