August 2019
Intermediate to advanced
786 pages
20h 22m
English
Issues due to expired passwords are a common support call type for helpdesks. The following script can generate a report about expiring passwords:
## Password Expire Report ##$passwordreport = $null$dc = (Get-ADDomain | Select DNSRoot).DNSRoot$Report= "C:\passwordreport.html"$HTML=@"<title>Password Expire Report For $dc</title><style>BODY{background-color :LightBlue}</style>"@$passwordreport = Get-ADUser -filter * –Properties "SamAccountName","pwdLastSet","msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "SamAccountName",@{Name="Last Password Change";Expression={[datetime]::FromFileTime($_."pwdLastSet")}},@{Name="Next Password Change";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} ...