PowerShell to find recently changed accounts

There is so much a sysadmin can do with PowerShell.  This is some code I captured from someone’s site  on seeing what accounts have been changed in the last -x days.  Simply change the value after AddDays to the time frame you want – this will give you all accounts that have changed within that window.

Get-ADUser -LDAPFilter {(useraccountcontrol:1.2.840.113556.1.4.803:=2)} -Properties whenChanged | Where-Object {$_.whenChanged -gt (Get-Date).AddDays(-3)} | Select-Object Name, whenChanged

I’ll try to do better in the future with ping backs, but for this post – sorry dude who I got this from – you will be unknown.


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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s