Saturday 5 May 2018

find list of new users created in Active directory

 


how to find list of users created in Active Directory
Method-1
$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated
Method-2
same thing for groups:
$When = ((Get-Date).AddDays(-30)).Date
Get-ADGroup -Filter {whenChanged -ge $When} -Properties whenChanged
Method-3
import-module activedireciory
Get-ADUser -Filter * -Searchbase "DC=ABC,DC=com" -Properties whenCreated | Where-Object {$_.whenCreated -ge ((Get-Date).AddDays(-30)).Date}| EXPORT-CSV C:TempStaff.csv
Method-4
Get-ADUser -SearchBase “DC=com” -Filter {(whenCreated -gt $startdate) -and (whenCreated -lt $enddate)}

No comments:
Write comments