-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-ADUserPWExpireDate.ps1
More file actions
26 lines (23 loc) · 924 Bytes
/
Get-ADUserPWExpireDate.ps1
File metadata and controls
26 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Function Get-ADUserPWExpireDate {
#region - Comment Based Help
<#
.SYNOPSIS
Gets the password expiration date for an AD User.
.DESCRIPTION
Gets the password expiration date for an AD User.
.PARAMETER Identity
An AD account object, specified with one of the following values: Distinguished Name, GUID, Security Identifier, Sam Account Name.
.EXAMPLE
Get-ADUserPWExpireDate -Identity azbikowski
#>
#endregion
Param(
[Parameter(Mandatory=$true,
Position=0)]
[alias("Username","DistinguishedName","SamAccountName","UserPrincipalName")]
[string]$Identity
)
Get-ADUser -Identity $Identity –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" `
| Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
}
Set-Alias -Name "Get-ADPWExpireDate" -Value Get-ADUserPWExpireDate