New-ADFineGrainedPasswordPolicy

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

Synopsis

Creates a new Active Directory fine grained password policy.

Description

The New-ADFineGrainedPasswordPolicy cmdlet creates a new Active Directory fine grained password policy. You can set commonly used fine grained password policy property values by using the cmdlet parameters. Property values that are not associated with cmdlet parameters can be set by using the OtherAttributes parameter.

You must set the Name and Precedence parameters to create a new fine grained password policy.

The following methods explain different ways to create an object by using this cmdlet.

Method 1: Use the New-ADFineGrainedPasswordPolicy cmdlet, specify the required parameters, and set any additional property values by using the cmdlet parameters.

Method 2: Use a template to create the new object. To do this, create a new fine grained password policy object or retrieve a copy of an existing fine grained password policy object and set the Instance parameter to this object. The object provided to the Instance parameter is used as a template for the new object. You can override property values from the template by setting cmdlet parameters. For examples and more information, see the Instance parameter description for this cmdlet.

Method 3: Use the Import-CSV cmdlet with the New-ADFineGrainedPasswordPolicy cmdlet to create multiple Active Directory fine grained password policy objects. To do this, use the Import-CSV cmdlet to create the custom objects from a comma-separated value (CSV) file that contains a list of object properties. Then pass these objects through the pipeline to the New-ADFineGrainedPasswordPolicy cmdlet to create the fine grained password policy objects.

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 three of the following five character types:

    Required?                    false
    Position?                    named
    Default value                $true
    Accept pipeline input?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    Accept wildcard characters?  false

-Instance <ADFineGrainedPasswordPolicy>
    Specifies an instance of a fine-grained password policy object to use as a template for a new fine-grained password policy object.

    Required?                    false
    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                0.00:30:00 (30 Minutes)
    Accept pipeline input?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    Accept wildcard characters?  false

-Name <String>
    Specifies the name of the object. This parameter sets the Name property of the Active Directory object. The LDAP Display Name (ldapDisplayName) of this property is "name".

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

-OtherAttributes <Hashtable>
    Specifies object attribute values for attributes that are not represented by cmdlet parameters. You can set one or more parameters at the same time with this parameter. If an attribute takes more than one value, you can assign multiple values. To identify an attribute, specify the LDAPDisplayName (ldapDisplayName) defined for it in the Active Directory schema.

    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                24
    Accept pipeline input?       True (ByPropertyName)
    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?                    true
    Position?                    2
    Default value                
    Accept pipeline input?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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?       True (ByPropertyName)
    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

New-ADFineGrainedPasswordPolicy [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-ComplexityEnabled <Boolean>] [-Credential <PSCredential>] [-Description <String>] [-DisplayName <String>] [-Instance <ADFineGrainedPasswordPolicy>] [-LockoutDuration <TimeSpan>] [-LockoutObservationWindow <TimeSpan>] [-LockoutThreshold <Int32>] [-MaxPasswordAge <TimeSpan>] [-MinPasswordAge <TimeSpan>] [-MinPasswordLength <Int32>] [-Name] <String> [-OtherAttributes <Hashtable>] [-PassThru] [-PasswordHistoryCount <Int32>] [-Precedence] <Int32> [-ProtectedFromAccidentalDeletion <Boolean>] [-ReversibleEncryptionEnabled <Boolean>] [-Server <String>] [<CommonParameters>]

Notes
This cmdlet does not work with AD LDS.

————————– EXAMPLE 1 ————————–
C:\PS>New-ADFineGrainedPasswordPolicy -Name “DomainUsersPSO” -Precedence 500 -ComplexityEnabled $true -Description “The Domain Users Password Policy” -DisplayName “Domain Users PSO” -LockoutDuration “0.14:00:00” -LockoutObservationWindow “0.00:16:00” -LockoutThreshold 10
Create a new Fine Grained Password Policy object named ‘DomainUsersPSO’ and set the Precedence, ComplexityEnabled, Description, DisplayName, LockoutDuration, LockoutObservationWindw, and LockoutThreshold properties on the object.

————————– EXAMPLE 2 ————————–
C:\PS>$templatePSO = New-Object Microsoft.ActiveDirectory.Management.ADFineGrainedPasswordPolicy
$templatePSO.ComplexityEnabled = $true
$templatePSO.LockoutDuration = [TimeSpan]::Parse(“0.12:00:00”)
$templatePSO.LockoutObservationWindow = [TimeSpan]::Parse(“0.00:15:00”)
$templatePSO.LockoutThreshold = 5
$templatePSO.MinPasswordAge = [TimeSpan]::Parse(“0.00:10:00”)
$templatePSO.PasswordHistoryCount = 30
$templatePSO.ReversibleEncryptionEnabled = $false
New-ADFineGrainedPasswordPolicy -Instance $templatePSO -Name “SvcAccPSO” -Precedence 100 -Description “The Service Accounts Password Policy” -DisplayName “Service Accounts PSO” -MaxPasswordAge “30.00:00:00” -MinPasswordLength 16
New-ADFineGrainedPasswordPolicy -Instance $templatePSO -Name “AdminsPSO” -Precedence 300 -Description “The Domain Administrators Password Policy” -DisplayName “Domain Administrators PSO” -MaxPasswordAge “16.00:00:00” -MinPasswordLength 10

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

Get-Command New-ADFineGrainedPasswordPolicy

Get-Command New-ADFineGrainedPasswordPolicy powershell script command cmdlet

You can also read about
. Get-ADFineGrainedPasswordPolicy
. Remove-ADFineGrainedPasswordPolicy
. Set-ADFineGrainedPasswordPolicy

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 *