Site icon TOSS

Get-ADDomain

powershell

Get-ADDomain is accessible with the help of addsadministration module. To install addsadministration on your system please refer to this link.

Synopsis

Gets an Active Directory domain.

Description

The Get-ADDomain cmdlet gets the Active Directory domain specified by the parameters. You can specify the domain by setting the Identity or Current parameters.

The Identity parameter specifies the Active Directory domain to get. You can identify the domain object to get by its Distinguished Name (DN), GUID, Security Identifier (SID), DNS domain name, or NetBIOS name. You can also set the parameter to a domain object variable, such as $ or pass a domain object through the pipeline to the Identity parameter.

To get the domain of the local computer or current logged on user (CLU) set the Current parameter to LocalComputer or LoggedOnUser. When you set the Current parameter, you do not need to set the Identity parameter.

When the Current parameter is set to LocalComputer or LogedOnUser, the cmdlet uses the Server and Credential parameters according to the following rules.

-If both the Server and Credential parameters are not specified:

--The domain is set to the domain of the LocalComputer or LoggedOnUser and a server is located in this domain. The credentials of the current logged on user are used to get the domain.

-If the Server parameter is specified and the Credential parameter is not specified:

--The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the LocalComputer or LoggedOnUser. Then the credentials of the current logged on user are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.

-If the Server parameter is not specified and the Credential parameter is specified:

--The domain is set to the domain of the LocalComputer or LoggedOnUser and a server is located in this domain. Then the credentials specified by the Credential parameter are used to get the domain.

If the Server and Credential parameters are specified:

The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the LocalComputer or LoggedOnUser. Then the credentials specified by the Credential parameter are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.

Parameters

-AuthType 
         Specifies the authentication method to use. Possible values for this parameter include:

    Required?                    false
    Position?                    named
    Default value                Microsoft.ActiveDirectory.Management.AuthType.Negotiate
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Credential <PSCredential>
    Specifies the user account credentials to use to perform this task. The default credentials are the credentials of the currently logged on user unless the cmdlet is run from an Active Directory PowerShell provider drive. If the cmdlet is run from such a provider drive, the account associated with the drive is the default.

    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Current <ADCurrentDomainType>
    Specifies whether to return the domain of the local computer or the current logged on user (CLU). Possible values for this parameter are:

    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

-Identity <ADDomain>
    Specifies an Active Directory domain object by providing one of the following property values. The identifier in parentheses is the LDAP display name for the attribute. All values are for the domainDNS object that represents the domain.

    Required?                    true
    Position?                    1
    Default value                
    Accept pipeline input?       True (ByValue)
    Accept wildcard characters?  false

-Server <String>
    Specifies the Active Directory Domain Services instance to connect to, by providing one of the following values for a corresponding domain name or directory server. The service may be any of the following:  Active Directory Lightweight Domain Services, Active Directory Domain Services or Active Directory Snapshot instance.

    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    Accept wildcard characters?  false

Syntax

Get-ADDomain [-AuthType <ADAuthType>] [-Credential <PSCredential>] [-Current <ADCurrentDomainType>] [-Server <String>] [<CommonParameters>]

Get-ADDomain [-AuthType <ADAuthType>] [-Credential <PSCredential>] [-Identity] <ADDomain> [-Server <String>] [<CommonParameters>]

Notes
This cmdlet does not work with AD LDS.

————————– EXAMPLE 1 ————————–
C:\PS>Get-ADDomain TOSSolution.com
Gets the domain information for the domain ‘ TOSSolution .com’.

————————– EXAMPLE 2 ————————–
C:\PS>Get-ADDomain -Current LocalComputer
Get the domain information of the current local computer domain.

————————– EXAMPLE 3 ————————–
C:\PS>Get-ADDomain -Current LoggedOnUser
Gets the domain information for the domain of the currently logged on user.

————————– EXAMPLE 4 ————————–
C:\PS>Get-ADDomain

AllowedDNSSuffixes                 : {}
ChildDomains                       : {}
ComputersContainer                 : CN=Computers,DC=TOSSolution,DC=com
DeletedObjectsContainer            : CN=Deleted Objects,DC=TOSSolution,DC=com
DistinguishedName                  : DC=TOSSolution,DC=com
DNSRoot                            : TOSSolution.com
DomainControllersContainer         : OU=Domain Controllers,DC=Fabrikam,DC=com
DomainMode                         : Windows2003Domain
DomainSID                          : S-1-5-21-41432690-3719764436-1984117282
ForeignSecurityPrincipalsContainer : CN=ForeignSecurityPrincipals,DC=TOSSolution,DC=com
Forest                             : TOSSolution .com
InfrastructureMaster               : TOSSolution-DC1.TOSSolution.com
LastLogonReplicationInterval       :
LinkedGroupPolicyObjects           : {CN={31B2F340-016D-11D2-945F-00C04FB984F9},CN=Policies,CN=System,DC=TOSSolution,DC=com}
LostAndFoundContainer              : CN=LostAndFound,DC=TOSSolution,DC=com
ManagedBy                          :
Name                               : TOSSolution
NetBIOSName                        : TOSSolution
ObjectClass                        : domainDNS
ObjectGUID                         : b63b4f44-58b9-49cf-8911-b36e8575d5eb
ParentDomain                       :
PDCEmulator                        : TOSSolution-DC1.TOSSolution.com
QuotasContainer                    : CN=NTDS Quotas,DC=TOSSolution,DC=com
ReadOnlyReplicaDirectoryServers    : {CSD2722780.TOSSolution.com}
ReplicaDirectoryServers            : {TOSSolution-DC1.TOSSolution.com}
RIDMaster                          : TOSSolution-DC1.TOSSolution.com
SubordinateReferences              : {DC=ForestDnsZones,DC=TOSSolution,DC=com, DC=DomainDnsZones,DC=TOSSolution,DC=com, CN=Co
nfiguration,DC=Fabrikam,DC=com}
SystemsContainer                   : CN=System,DC=TOSSolution,DC=com
UsersContainer                     : CN=Users,DC=TOSSolution,DC=com

Gets the domain information for the domain of the currently logged on user.

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Get-ADDomain

You can also read about
. Set-ADDomain
. Set-ADDomainMode

To know more PowerShell cmdlets(Commands) on addsadministration (Active Directory) click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site http://tossolution.com/

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

Exit mobile version