Author Posts

September 10, 2014 at 6:12 am

I am using get-adcomputer to get the PasswordLastSet date. I would like to change this to yyyy-mm-dd. Can someone help me with this? I've tried some things with no luck at all.

September 10, 2014 at 6:16 am

ah, just got it:

$d = $Computername.PasswordLastSet
$d = $d.ToShortDateString()


September 10, 2014 at 6:22 am

Since PasswordLastSet is a System.DateTime object, it can be manipulated in all the same ways. The ToString() method can be used to specify exactly how the date should be formatted.

$computer = Get-ADComputer Computer01 -Properties PasswordLastSet

September 10, 2014 at 6:27 am

Way better, thanks!