Users with Password Change since Midnight

This script converts 12:00AM for the current day to the NT Epoch version and then pulls a list of users who have set their password since midnight.

$startOfNTTime = Get-Date 1/1/1601;
$currentTime = Get-Date;
#UTC Offset
$offSet = 4;
$midNightTimeStamp = ($currentTime.Date.AddHours($offSet) - $startOfNTTime).ticks;
(Get-ADUser -Filter { pwdLastSet -ge $midNightTimeStamp } -properties pwdLastSet).SamAccountName;

Leave a comment