Today I will share with you short script in PowerShell, which is checking last time created account in Active Directory.
1 2 |
$time = (Get-Date).AddDays(-1) $users = Get-ADUser -Filter {whenCreated -gt $time} -Properties whenCreated | Select-Object Name, whenCreated |
In parameter called $time we set time, how many days back we want to check accounts were created. I set I set it to 1 day and the scheduler is activated every day. If there are some results it sending mail with informations about accounts.