A function that can be passed a date from AD, such as the lastlogon attribute and returns a string of the date, or the string 'Never'.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns a date string based on an AD attribute (like lastlogon, or accountexpires). | |
# Param1: $addate - AD attribute date value. | |
Function Get-ADDate($addate) | |
{ | |
Try | |
{ | |
$formatteddate = [datetime]::FromFileTime($addate).Date.ToString() | |
} | |
Catch | |
{ | |
$formatteddate = "Never" | |
} | |
return $formatteddate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment