change time format RRS feed

  • General discussion

  • Hi,

    I am executing the below command to get the all computers local built-in administrator password  and password expiry time

    get-adcomputer -Filter * -Properties * | select @{Label="Name";Expression={$_.name}}, @{Label="OS";Expression={$_.operatingsystem}}, @{Label="Distinguished name";Expression={$_.'distinguishedname'}}, @{Label="Password ExpirationTime";Expression={$_.'ms-Mcs-AdmPwdExpirationTime'}}, @{Label="Password";Expression={$_.'ms-Mcs-AdmPwd'}} | Export-Csv C:\laps.csv -NoTypeInformation -Append

    password expiry time is displaying like 132092891835963000

    Output file generates in CSV format. Please help how to change the format to date like 7/24/2019  12:00:00 AM

    Regards, Boopathi

    Wednesday, July 24, 2019 12:16 PM

All replies

  • Get-ADuser R564441 -Properties msDS-UserPasswordExpiryTimeComputed | select Name, {[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}
    An example but should work the same for your command

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Wednesday, July 24, 2019 12:35 PM