phillips321 / adaudit

Powershell script to do domain auditing automation
https://www.phillips321.co.uk
374 stars 100 forks source link

Account created dates #17

Open flukes86 opened 3 years ago

flukes86 commented 3 years ago

Hi, thanks for sharing. I was wondering whether you could add something to identify newly created accounts to the effects of:

$DateCutOff = (Get-Date).AddDays(-30) Get-ADUser -Filter * -Properties whenCreated | where {$_.whenCreated -gt $DateCufOff} | FT Name, whenCreated

phillips321 commented 2 years ago

Feel free to add this and create a pull request and we'll merge it. Many thanks

Cool34000 commented 2 years ago

Can be done directly with a filter (and also on groups!)

$DateCutOff = ((Get-Date).AddDays(-30)).Date
$newUsers = Get-ADUser  -Filter {whenCreated -ge $DateCutOff} -Properties whenCreated | select whenCreated,SamAccountName
$newGroups = Get-ADGroup -Filter {whenCreated -ge $DateCutOff} -Properties whenCreated | select whenCreated,SamAccountName
Cool34000 commented 2 years ago

https://github.com/phillips321/adaudit/pull/21