Set-ADDefaultDomainPasswordPolicy

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

Synopsis

Modifies the default password policy for an Active Directory domain.

Description

The Set-ADDefaultDomainPasswordPolicy cmdlet modifies the properties of the default password policy for a domain. You can modify property values by using the cmdlet parameters.

The Identity parameter specifies the domain whose default password policy you want 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 parameter to an ADDomain object variable, or pass an ADDomain 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-ADDomainDefaultPasswordPolicy cmdlet.

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

-ComplexityEnabled <Boolean>
    Specifies whether password complexity is enabled for the password policy. If enabled, the password must contain two of the following three character types:

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

-LockoutDuration <TimeSpan>
    Specifies the length of time that an account is locked after the number of failed login attempts exceeds the lockout threshold. You cannot login to an account that is locked until the lockout duration time period has expired. This parameter sets the lockoutDuration property of a password policy object. The LDAP display name (ldapDisplayName) of this property is "msDS-LockoutDuration".

    Required?                    false
    Position?                    named
    Default value                0.00:30:00 (30 Minutes)
    Accept pipeline input?       false
    Accept wildcard characters?  false

-LockoutObservationWindow <TimeSpan>
    Specifies the maximum time interval between two unsuccessful login attempts before the number of unsuccessful login attempts is reset to 0. An account is locked when the number of unsuccessful login attempts exceeds the password policy lockout threshold. This parameter sets the lockoutObservationWindow property of a password policy object. The LDAP Display Name (ldapDisplayName) of this property is "msDS-lockoutObservationWindow".

    Required?                    false
    Position?                    named
    Default value                0.00.30.00 (30 Minutes)
    Accept pipeline input?       false
    Accept wildcard characters?  false

-LockoutThreshold <Int32>
    Specifies the number of unsuccessful login attempts that are permitted before an account is locked out. This number increases when the time between unsuccessful login attempts is less than the time specified for the lockout observation time window. This parameter sets the LockoutThreshold property of a password policy.

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

-MaxPasswordAge <TimeSpan>
    Specifies the maximum length of time that you can have the same password. After this time period, the password expires and you must create a new one.

    Required?                    false
    Position?                    named
    Default value                42.00:00:00 (42 days)
    Accept pipeline input?       false
    Accept wildcard characters?  false

-MinPasswordAge <TimeSpan>
    Specifies the minimum length of time before you can change a password.

    Required?                    false
    Position?                    named
    Default value                1.00:00:00 (1day)
    Accept pipeline input?       false
    Accept wildcard characters?  false

-MinPasswordLength <Int32>
    Specifies the minimum number of characters that a password must contain.  This parameter sets the MinPasswordLength property of the password policy.

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

-PasswordHistoryCount <Int32>
    Specifies the number of previous passwords to save.  A user cannot reuse a password in the list of saved passwords. This parameter sets the PasswordHistoryCount property for a password policy.

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

-ReversibleEncryptionEnabled <Boolean>
    Specifies whether the directory must  store passwords using reversible encryption. This parameter sets the ReversibleEncryption property for a password policy. Possible values for this parameter include the following:

    Required?                    false
    Position?                    named
    Default value                $true
    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-ADDefaultDomainPasswordPolicy [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-ComplexityEnabled <Boolean>] [-Credential <PSCredential>] [-Identity] <ADDefaultDomainPasswordPolicy> [-LockoutDuration <TimeSpan>] [-LockoutObservationWindow <TimeSpan>] [-LockoutThreshold <Int32>] [-MaxPasswordAge <TimeSpan>] [-MinPasswordAge <TimeSpan>] [-MinPasswordLength <Int32>] [-PassThru] [-PasswordHistoryCount <Int32>] [-ReversibleEncryptionEnabled <Boolean>] [-Server <String>] [<CommonParameters>]

Notes
This cmdlet does not work with AD LDS.

————————– EXAMPLE 1 ————————–
C:\PS>Set-ADDefaultDomainPasswordPolicy -Identity TOSSolution.com -LockoutDuration 00:30:00 -LockoutObservationWindow 00:20:00 -ComplexityEnabled $true -ReversibleEncryptionEnabled $false -MaxPasswordAge 10.00:00:00
Set the default domain password policy for a given domain. Note: setting MaxPwdAge to 0 will convert it to ‘never’ (Int64.MinValue or -9223372036854775808 in the directory).

————————– EXAMPLE 2 ————————–
C:\PS>Get-ADDefaultDomainPasswordPolicy -Current LoggedOnUser | Set-ADDefaultDomainPasswordPolicy -LockoutDuration 00:30:00 -LockoutObservationWindow 00:20:00 -ComplexityEnabled $true -ReversibleEncryptionEnabled $false -MinPasswordLength 14
Set the default domain password policy for the current logged on user domain.

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

Get-Command Set-ADDefaultDomainPasswordPolicy

Get-Command Set-ADDefaultDomainPasswordPolicy powershell script command cmdlet

You can also read about
. Get-ADDefaultDomainPasswordPolicy

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 *