Skip to content

Instantly share code, notes, and snippets.

View soulhakr's full-sized avatar

Dave soulhakr

View GitHub Profile
@soulhakr
soulhakr / Get-ADUserPasswordExpiration.ps1
Last active January 23, 2023 19:06
[Get Active Directory User Password Expiration] #powershell #windows #activedirectory #usermanagement
# Get the date and time of an Active Directory user account given the username
#
# If the password is going to expire in the next 30 days the script will exit with
# 1, otherwise it will exit with 0.
# If the password is set to never expire, the script will return "Never"
# If the user account is not found, the script will return "Not Found
# Usage: Get-ADUserPasswordExpiration.ps1 -Identity <username>
# Example: Get-ADUserPasswordExpiration.ps1 -Identity jsmith
[CmdletBinding()]