I am trying to convert the accountexpires property to something that is a date. I thought it might be the same as { [datetime]::fromFileTime($_.lastLogonTimestamp) } but it looks like this is not the case.
can anyone please advise? Thank you. in advance
$ADComputerProperties = @(# Hashtable for computer properties "Name", "SAMAccountName", "DNSHostName", "PasswordLastSet", "Enabled", "whenCreated", "accountExpires", "OperatingSystem", "OperatingSystemServicePack", "OperatingSystemVersion", "UserAccountControl", "LastLogonTimeStamp", "DistinguishedName" ) $ADComputerPropertiesShown = @(# Hashtable for select "Name", "SAMAccountName", "DNSHostName", "PasswordLastSet", "Enabled", "whenCreated", @{ name = 'accountExpires'; expression = { [datetime]::fromFileTime($_.accountExpires) } }, "accountExpires", "OperatingSystem", "OperatingSystemServicePack", "OperatingSystemVersion", "UserAccountControl" @{ name = 'lastLogonTimestamp'; expression = { [datetime]::fromFileTime($_.lastLogonTimestamp) } }, "DistinguishedName" ) Get-ADComputer -Filter { OperatingSystem -NotLike "*server*" } -Properties $ADComputerProperties | select $ADComputerPropertiesShown | Export-Csv "c:\temp\Justice_Desktop_Report-$filenamebit.csv"