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;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s