0%
Command Summary

Command Summary

Detailed guide to Command Summary

10-15 min

📚 Detailed Course: Retrieving the Password Policy in Active Directory with PowerShell

In this course, you will learn how to use PowerShell to retrieve and verify a domain's default password policy in Active Directory (AD) with the Get-ADDefaultDomainPasswordPolicy command. This command lets you view the security settings applied to passwords in the domain, such as the required complexity and the lockout duration.


✨ Command Summary

# 🔐 Retrieve the domain's default password policy
Get-ADDefaultDomainPasswordPolicy

# 🌐 Retrieve the default password policy of a specific domain
Get-ADDefaultDomainPasswordPolicy -Server paris.lab.lan

# ✅ Check whether the password policy meets complexity and lockout criteria
$MDPComplexe       = $true
$DureeVerrouillage = "00:30:00"
$StrategieMDP = Get-ADDefaultDomainPasswordPolicy -Identity lab.lan

if($StrategieMDP.ComplexityEnabled -eq $MDPComplexe) {
   Write-Host "La stratégie de mot de passe répond aux exigences de complexité" -ForegroundColor Green
}

if($StrategieMDP.LockoutDuration -ne $DureeVerrouillage) {
   Write-Host "La durée de verrouillage ne répond pas aux exigences" -ForegroundColor Red
}
Link copied!