PowerTip: Use PowerShell to Find Name & OS Version of Domain Controllers

PowerTip: Use PowerShell to Find Name & OS Version of Domain Controllers

  • Comments 3
  • Likes

Summary: Use Windows PowerShell to find the name and operating system version of all your domain controllers.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the name and operating system version of all my domain controllers?

Hey, Scripting Guy! Answer Use the Get-ADDomainController cmdlet from the Active Directory module and a wild card filter to select all domain controllers. Then pipe the results to the Select-Object cmdlet and choose the Name and OperatingSystem properties.

Get-ADDomainController -Filter * | select name, operatingsystem

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • How can I pull this information from all child domains?

  • @Derrick The Get-ADDomainController cmdlet has a -DomainName parameter that permits you to specify the domain name. You could populate that value with your childdomains. The Get-ADDOmain cmdlet will return childdomains.

  • Get-ADDomainController -Filter * | select name, operatingsystem,HostName,site,IsGlobalCatalog,IsReadOnly | Export-Csv c:\dcinventory.csv