다음을 통해 공유


Domain Controllers Details Using PowerShell

Requirement:
Chen! get me list of domain controllers in our environment. Solution:

Get-ADDomainController -Filter * |
Select-Object name

Sorry, we don't want to use Active Directory PowerShell Module - Better give us using ADSI ADSI way of doing it.

[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers |
Select -Property Name

How to get count of DC?

([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers).Count

We ideally wants to know the time details of all the DC's

([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers) |
Select -Property Name , Currenttime

Enjoy PowerShell.