< Back

Get-CADDomainController

Sun Jan 12, 2020 9:32 pm

NAME Get-CADDomainController



SYNOPSIS

Gets the domain controller of the current computer's domain, or for a

specific domain.





SYNTAX

Get-CADDomainController [[-Domain] <String>] [<CommonParameters>]





DESCRIPTION

When working with Active Directory, it's important to have the hostname of

the domain controller you need to work with. This function will find the

domain controller for the domain of the current computer or the domain

controller for a given domain.





PARAMETERS

-Domain <String>

The domain whose domain controller to get. If not given, gets the

current computer's domain controller.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.String. The hostname for the domain controller. If the domain

controller is not found, $null is returned.





-------------------------- EXAMPLE 1 --------------------------



>Get-CADDomainController



Returns the domain controller for the current computer's domain.

Approximately equivialent to the hostname given in the LOGONSERVER

environment variable.









-------------------------- EXAMPLE 2 --------------------------



>Get-CADDomainController -Domain MYDOMAIN



Returns the domain controller for the MYDOMAIN domain.











RELATED LINKS