Skip to content

Instantly share code, notes, and snippets.

@D4R4
Created June 17, 2021 11:43
Show Gist options
  • Save D4R4/07ab148f55171386204d030c3eadb595 to your computer and use it in GitHub Desktop.
Save D4R4/07ab148f55171386204d030c3eadb595 to your computer and use it in GitHub Desktop.
Powershell scripts to list and sort users by their last password change on-premise and AzureAD
Get-ADUser -Filter * -properties passwordlastset -SearchBase "CN=Users,DC=local,DC=net" | Sort-Object -property passwordlastset | ft Name, passwordlastset
Connect-MsolService
Get-MsolUser -All | Select DisplayName,UserPrincipalName,LastPasswordChangeTimeStamp | Sort-Object -property LastPasswordChangeTimeStamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment