Private/Get-FineGrainedPolicies.ps1
function Get-FineGrainedPolicies { $fineGrainedPoliciesData = Get-ADFineGrainedPasswordPolicy -Filter * -Server $($Env:USERDNSDOMAIN) $fineGrainedPolicies = foreach ($policy in $fineGrainedPoliciesData) { [PsCustomObject] @{ 'Name' = $policy.Name 'Complexity Enabled' = $policy.ComplexityEnabled 'Lockout Duration' = $policy.LockoutDuration 'Lockout Observation Window' = $policy.LockoutObservationWindow 'Lockout Threshold' = $policy.LockoutThreshold 'Max Password Age' = $policy.MaxPasswordAge 'Min Password Length' = $policy.MinPasswordLength 'Min Password Age' = $policy.MinPasswordAge 'Password History Count' = $policy.PasswordHistoryCount 'Reversible Encryption Enabled' = $policy.ReversibleEncryptionEnabled 'Precedence' = $policy.Precedence 'Applies To' = $policy.AppliesTo 'Distinguished Name' = $policy.DistinguishedName } } return $fineGrainedPolicies } |