Powershell to Query Active directory

Powershell to Query Active directory and get the list of Domain controllers in the current AD Site which you server is located


%{[System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite().Servers | % { $_.Name} }

 

 

Powershell to Query Active directory to get the current AD sites


 [System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite().name

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s