This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
networking:windows:active_directory:ad_password_policy [2020/09/25 09:28] gcooper |
networking:windows:active_directory:ad_password_policy [2020/09/28 10:51] (current) gcooper |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Active Directory Password Policy ====== | ====== Active Directory Password Policy ====== | ||
+ | |||
+ | ===== Check a User's Password and Policy ===== | ||
+ | |||
+ | Check when a user password expires: | ||
+ | |||
+ | < | ||
+ | net user USERNAME /domain | ||
+ | |||
+ | Get-ADUserResultantPasswordPolicy USERNAME | ||
+ | </ | ||
===== Default Domain Password Policy ===== | ===== Default Domain Password Policy ===== | ||
< | < | ||
- | get-addomain | get-adobject -properties * | select *pwd* | + | Get-ADDefaultDomainPasswordPolicy |
</ | </ | ||
Line 10: | Line 20: | ||
===== Fine-Grained Password Policy ===== | ===== Fine-Grained Password Policy ===== | ||
+ | |||
+ | https:// | ||
http:// | http:// | ||
- | {{ : | + | **CloudPanel**: |
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Show Fine-Grained Password Policies ==== | ||
+ | |||
+ | < | ||
+ | Get-ADFineGrainedPasswordPolicy -Filter * | ||
+ | </ | ||
+ | |||
+ | ==== Show Per User Policy ==== | ||
+ | |||
+ | < | ||
+ | Get-ADUserResultantPasswordPolicy username | ||
+ | </ | ||
+ | |||
+ | Or to show all users: | ||
+ | |||
+ | < | ||
+ | function Get-MTUserPasswordPolicy ($Identity) | ||
+ | { | ||
+ | $Fgpp = (Get-ADUserResultantPasswordPolicy -Identity $Identity).Name | ||
+ | [string]$Policy = switch ($Fgpp) | ||
+ | { | ||
+ | $null {" | ||
+ | {!($null)} {$Fgpp} | ||
+ | } | ||
+ | |||
+ | $Return = New-Object -TypeName PSObject | ||
+ | $Return | Add-Member -MemberType NoteProperty -Name Identity -Value $Identity | ||
+ | $Return | Add-Member -MemberType NoteProperty -Name PasswordPolicy -Value $Policy | ||
+ | |||
+ | return $Return | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Then call the function: | ||
+ | |||
+ | < | ||
+ | Get-ADUser -Filter {Enabled -eq $True} | ForEach-Object {Get-MTUserPasswordPolicy -Identity $_.SamAccountName} | ||
+ | </ |