Set-ADDomain

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

Synopsis

Modifies an Active Directory domain.

Description

The Set-ADDomain cmdlet modifies the properties of an Active Directory domain. You can modify commonly used property values by using the cmdlet parameters. Property values that are not associated with cmdlet parameters can be modified by using the Add, Replace, Clear and Remove parameters.

The Identity parameter specifies the domain to modify. You can identify a domain by its distinguished name (DN), GUID, security identifier (SID), DNS domain name, or NetBIOS name. You can also set the Identity parameter to an object variable such as $, or you can pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADDomain cmdlet to retrieve a domain object and then pass the object through the pipeline to the Set-ADDomain cmdlet.

The Instance parameter provides a way to update a domain object by applying the changes made to a copy of the domain object. When you set the Instance parameter to a copy of an Active Directory domain object that has been modified, the Set-ADDomain cmdlet makes the same changes to the original domain object. To get a copy of the object to modify, use the Get-ADDomain object. When you specify the Instance parameter you should not pass the identity parameter. For more information about the Instance parameter, see the Instance parameter description.

The following examples show how to modify the ManagedBy property of a domain object by using three methods:

-By specifying the Identity and the ManagedBy parameters
-By passing a domain object through the pipeline and specifying the ManagedBy parameter
-By specifying the Instance parameter.

Method 1: Modify the ManagedBy property for the London domain by using the Identity and ManagedBy parameters.
Set-ADDomain -Identity London -ManagedBy RaviS

Method 2: Modify the ManagedBy property for the London domain by passing the London domain through the pipeline and specifying the ManagedBy parameter.
Get-ADDomain London | Set-ADDomain -ManagedBy RaviS

Method 3: Modify the ManagedBy property for the London domain by using the Windows PowerShell command line to modify a local instance of the London domain. Then set the Instance parameter to the local instance.
$domain = Get-ADDomain London
$domain.ManagedBy = RaviS
Set-ADDomain -Instance $domain.

Parameters

-Add 
         Specifies values to add to an object property. Use this parameter to add one or more values to a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can specify multiple values to a property by specifying a comma-separated list of values and more than one property by separating them using a semicolon.. The format for this parameter is

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

-AllowedDNSSuffixes <Hashtable>
    Modifies the list of domain name server (DNS) suffixes that are allowed in a domain. This parameter sets the value of the msDS-AllowedDNSSuffixes attribute of the domainDNS object. This parameter uses the following syntax to add, remove, replace, or clear DNS suffix values.

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

-AuthType <ADAuthType>
    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

-Clear <String[]>
    Specifies an array of object properties that will be cleared in the directory. Use this parameter to clear one or more values of a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can modify more than one property by specifying a comma-separated list. The format for this parameter is

    Required?                    false
    Position?                    named
    Default value                
    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

-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

-Instance <ADDomain>
    Specifies a modified copy of a domain object to use to update the actual Active Directory domain object. When this parameter is used, any modifications made to the modified copy of the object are also made to the corresponding Active Directory object. The cmdlet only updates the object properties that have changed.

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

-LastLogonReplicationInterval <TimeSpan>
    Specifies the time, in days, within which the last logon time of an account must be replicated across all domain controllers in the domain. This parameter sets the LastLogonReplicationInterval property for a domain. The LDAP display name (ldapDisplayName) for this property is msDS-LogonTimeSyncInterval. The last logon replication interval must be at least one day. Setting the last logon replication interval to a low value can significantly increase domain-wide replication.

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

-ManagedBy <ADPrincipal>
    Specifies the user or group that manages the object by providing one of the following property values. Note: The identifier in parentheses is the LDAP display name for the property.

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

-PassThru <SwitchParameter>
    Returns the new or modified object. By default (i.e. if -PassThru is not specified), this cmdlet does not generate any output.

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

-Remove <Hashtable>
    Specifies that the cmdlet remove values of an object property. Use this parameter to remove one or more values of a property that cannot be modified using a cmdlet parameter. To remove an object property, you must use the LDAP display name. You can remove more than one property by specifying a semicolon-separated list. The format for this parameter is

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

-Replace <Hashtable>
    Specifies values for an object property that will replace the current values. Use this parameter to replace one or more values of a property that cannot be modified using a cmdlet parameter. To modify an object property, you must use the LDAP display name. You can modify more than one property by specifying a comma-separated list. The format for this parameter is

    Required?                    false
    Position?                    named
    Default value                
    Accept pipeline input?       false
    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

-Confirm <SwitchParameter>
    Prompts you for confirmation before running the cmdlet.

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

-WhatIf <SwitchParameter>
    Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Syntax

Set-ADDomain [-WhatIf] [-Confirm] [-Add <Hashtable>] [-AllowedDNSSuffixes <Hashtable>] [-AuthType <ADAuthType>] [-Clear <String[]>] [-Credential <PSCredential>] [-Identity] <ADDomain> [-LastLogonReplicationInterval <TimeSpan>] [-ManagedBy <ADPrincipal>] [-PassThru] [-Remove <Hashtable>] [-Replace <Hashtable>] [-Server <String>] [<CommonParameters>]

Set-ADDomain [-WhatIf] [-Confirm] [-AllowedDNSSuffixes <Hashtable>] [-AuthType <ADAuthType>] [-Credential <PSCredential>] -Instance <ADDomain> [-LastLogonReplicationInterval <TimeSpan>] [-ManagedBy <ADPrincipal>] [-PassThru] [-Server <String>] [<CommonParameters>]

Notes
This cmdlet does not work with AD LDS.

————————– EXAMPLE 1 ————————–
C:\PS>Set-ADDomain -Identity TOSSolution -AllowedDNSSuffixes @{Replace=”TOSSolution.com”,”Delhi.TOSSolution.com”}
Sets the value of AllowedDNSSuffixes to {“TOSSolution.com”,”Delhi.TOSSolution.com”} in domain “TOSSolution”.

————————– EXAMPLE 2 ————————–
C:\PS>Set-ADDomain -Identity TOSSolution -AllowedDNSSuffixes @{Add=”Delhi.TOSSolution.com”}
Adds the value “Delhi.TOSSolution.com” to the AllowedDNSSuffixes in domain “TOSSolution”.

————————– EXAMPLE 3 ————————–
C:\PS>Set-ADDomain -Identity TOSSolution -ManagedBy ‘CN=Domain Admins,CN=Users,DC=TOSSolution,DC=COM’
Sets the ManagedBy property in domain “TOSSolution” to ‘CN=Domain Admins,CN=Users,DC=TOSSolution,DC=COM’.

————————– EXAMPLE 4 ————————–
C:\PS>Get-ADDomain | Set-ADDomain -LastLogonReplicationInterval “10”
Sets the LastLogonReplicationInterval of the current logged on user domain to “10”.

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

Get-Command Set-ADDomain

Get-Command Set-ADDomain powershell script command cmdlet

You can also read about
. Get-ADDomain

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

Leave a Reply

Your email address will not be published. Required fields are marked *