Synopsis
Description
The Identity parameter specifies the Active Directory fine grained password policy to modify. You can identify a fine grained password policy by its distinguished name (DN), GUID or 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-ADFineGrainedPasswordPolicy cmdlet to retrieve a fine grained password policy object and then pass the object through the pipeline to the Set-ADFineGrainedPasswordPolicy cmdlet.
The Instance parameter provides a way to update a fine grained password policy object by applying the changes made to a copy of the object. When you set the Instance parameter to a copy of an Active Directory fine grained password policy object that has been modified, the Set-ADFineGrainedPasswordPolicy cmdlet makes the same changes to the original fine grained password policy object. To get a copy of the object to modify, use the Get-ADFineGrainedPasswordPolicy object. The Identity parameter is not allowed when you use the Instance parameter. For more information about the Instance parameter, see the Instance parameter description. For more information about how the Instance concept is used in Active Directory cmdlets, see about_ActiveDirectory_Instance
-By specifying the Identity and the Precedence parameters
-By passing a fine grained password policy object through the pipeline and specifying the Precedence parameter
-By specifying the Instance parameter.
Method 1: Modify the Precedence property for the L3Policyfine grained password policy by using the Identity and Precedence parameters.
Set-ADFineGrainedPasswordPolicy -Identity “L3Policy” -Precedence 150
Method 2: Modify the Precedence property for the L3Policyfine grained password policy by passing the L3Policyfine grained password policy through the pipeline and specifying the Precedence parameter.
Get-ADFineGrainedPasswordPolicy -Identity “L3Policy”| Set-ADFineGrainedPasswordPolicy -Precedence 150
Method 3: Modify the Precedence property for the L3Policy fine grained password policy by using the Windows PowerShell command line to modify a local instance of the L3Policyfine grained password policy. Then set the Instance parameter to the local instance.
$fineGrainedPasswordPolicy = Get-ADFineGrainedPasswordPolicy L3Policy
$fineGrainedPasswordPolicy.Precedence = 150
Set-ADFineGrainedPasswordPolicy -Instance $fineGrainedPasswordPolicy
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
-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
-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
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
-Description <String>
Specifies a description of the object. This parameter sets the value of the Description property for the object. The LDAP Display Name (ldapDisplayName) for this property is "description".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-DisplayName <String>
Specifies the display name of the object. This parameter sets the DisplayName property of the object. The LDAP Display Name (ldapDisplayName) for this property is "displayName".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Identity <ADFineGrainedPasswordPolicy>
Specifies an Active Directory fine-grained password policy object by providing one of the following property values. The identifier in parentheses is the LDAP display name for the attribute.
Required? true
Position? 1
Default value
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Instance <ADFineGrainedPasswordPolicy>
Specifies a modified copy of a fine-grained password policy object to use to update the actual Active Directory fine-grained password policy 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
-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
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
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
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
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
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
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
Accept pipeline input? false
Accept wildcard characters? false
-Precedence <Int32>
Specifies a value that defines the precedence of a fine-grained password policy among all fine-grained password policies. This parameter sets the Precedence property for a fine-grained password policy. The LDAP display name (ldapDisplayName) for this property is "msDS-PasswordSettingsPrecedence".
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ProtectedFromAccidentalDeletion <Boolean>
Specifies whether to prevent the object from being deleted. When this property is set to true, you cannot delete the corresponding object without changing the value of the property. Possible values for this parameter include:
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
-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
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-ADFineGrainedPasswordPolicy [-WhatIf] [-Confirm] [-Add <Hashtable>] [-AuthType <ADAuthType>] [-Clear <String[]>] [-ComplexityEnabled <Boolean>] [-Credential <PSCredential>] [-Description <String>] [-DisplayName <String>] [-Identity] <ADFineGrainedPasswordPolicy> [-LockoutDuration <TimeSpan>] [-LockoutObservationWindow <TimeSpan>] [-LockoutThreshold <Int32>] [-MaxPasswordAge <TimeSpan>] [-MinPasswordAge <TimeSpan>] [-MinPasswordLength <Int32>] [-PassThru] [-PasswordHistoryCount <Int32>] [-Precedence <Int32>] [-ProtectedFromAccidentalDeletion <Boolean>] [-Remove <Hashtable>] [-Replace <Hashtable>] [-ReversibleEncryptionEnabled <Boolean>] [-Server <String>] [<CommonParameters>]
Set-ADFineGrainedPasswordPolicy [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-Credential <PSCredential>] -Instance <ADFineGrainedPasswordPolicy> [-PassThru] [-Server <String>] [<CommonParameters>]
This cmdlet does not work with AD LDS.
C:\PS>Set-ADFineGrainedPasswordPolicy MyPolicy -Precedence 100 -LockoutDuration 00:30:00 -LockoutObservationWindow 00:20:00 -ComplexityEnabled $true -ReversibleEncryptionEnabled $false -MinPasswordLength 14
Update the Precedence, LockoutDuration, LockoutObservationWindow, ComplexityEnabled, ReversibleEncryptionEnabled, and MinPasswordLength properties on the FineGrainedPasswordPolicy object with name MyPolicy.
C:\PS>Set-ADFineGrainedPasswordPolicy ‘CN=MyPolicy,CN=PWD Settings Container,CN=System,DC=TOSSolution,DC=COM’ -MinPasswordLength 14
Set the MinPasswordLength property on the FineGrainedPasswordPolicy object with DistinguishedName CN=MyPolicy,CN=PWD Settings Container,CN=System,DC=TOSSolution,DC=COM.
C:\PS>$fgpp = Get-ADFineGrainedPasswordPolicy MyPolicy
$fgpp.LockoutObservationWindow = [TimeSpan]::Parse(“0.00:30:00”)
$fgpp.LockoutThreshold = 10
$fgpp.MinPasswordLength = 14
$fgpp.PasswordHistoryCount = 24
Set-ADFineGrainedPasswordPolicy -Instance $fgpp
Get the FineGrainedPasswordPolicy object with name MyPolicy, Update a set of properties on the object and then write the modifications back to the directory using the instance parameter.
Get-Command Set-ADFineGrainedPasswordPolicy
. Get-ADFineGrainedPasswordPolicy
. New-ADFineGrainedPasswordPolicy
. Remove-ADFineGrainedPasswordPolicy