< Back

Get-DomainName

Sat Jan 18, 2020 9:45 pm

NAME Get-DomainName



SYNOPSIS

Enforces the behavior of getting the domain name.

If a domain name is provided, it will be used.

If a domain name is not provided, the domain name of the generating system will be used.





SYNTAX

Get-DomainName -DomainName <String> [-Format <String>] [<CommonParameters>]



Get-DomainName -ForestName <String> [-Format <String>] [<CommonParameters>]





DESCRIPTION





PARAMETERS

-DomainName <String>

The FQDN of the domain the configuration will be running on.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ForestName <String>

The FQDN of the forest the configuration will be running on.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Format <String>

Determines the format in which to convert the FQDN provided into and return back



Required? false

Position? named

Default value FQDN

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

string





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



PS C:\\>Get-DomainName -DomainName "contoso.com" -Format FQDN



Returns "contoso.com"









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



PS C:\\>Get-DomainName -DomainName "contoso.com" -Format NetbiosName



Returns "contoso"









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-DomainName -ForestName "contoso.com" -Format DistinguishedName



Returns "DC=contoso,DC=com"











RELATED LINKS