Get the App
SLTechnology News&Howtos  ›  Servers  › 

PowerShell lookup domain controller

Shulou Source: shulou.com Published: 2022-06-03 01:19:52 09月22日 Update

A simple script is written, which is suitable for use when you don't know which domain controllers are available, or in a large environment, it is not suitable to write the DC name to death.

Function Find-DomainController

{

Param

(

$Domain = ([System.DirectoryServices.ActiveDirectory.Domain]:: GetCurrentDomain ()) .Name

)

Name = $(New-Object DirectoryServices.Activedirectory.DirectoryContext ("Domain", $Domain))

[System.DirectoryServices.ActiveDirectory.DomainController]:: FindAll ($Name)

}

Find-DomainController

Simply open PowerShell on the domain member and execute it to output all the domain controller lists

Tags: Controller control situation just name member environment script output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi Redmi Linux Shulou Tech Info