Hello,
this is my code:
$When = ((Get-Date).AddDays(-7)).Date
Get-ADUser -Filter {whenCreated -ge $When} -Properties * whenCreated | Select-Object givenName, sn, SamAccountName, mail | Export-csv -path $env:userprofile\Desktop\aduserExportnew1208.csv -force -encoding utf8
I simply want to get a csv file of all users, that have been added to AD in the last 7 days with following parameters:
givenName, sn, SamAccountName, mail
but this script only returns me the given name and SamAccountName for whatever reason?! The other fields are blank despite they're not blank in AD.
What am I doing wrong?
Greetings,
Silver