Get-ADUser -Filter * -Properties EmailAddress | select givenName, surName, EmailAddress, State/Province | Export-CSV “C:\Scripts\Email_Addresses.csv”
Doesn’t seem to be working. I get the firstname, surname and email though.
Get-ADUser -Filter * -Properties EmailAddress | select givenName, surName, EmailAddress, State/Province | Export-CSV “C:\Scripts\Email_Addresses.csv”
Doesn’t seem to be working. I get the firstname, surname and email though.
If I’m not wrong the AD attribute name is only “state” not “state/province”. So it should be something like this:
Get-ADUser -Filter * -Properties EmailAddress | select givenName, surName, EmailAddress, State | Export-CSV “C:\Scripts\Email_Addresses.csv” -NoTypeInformation
I tried just state but it doesn’t work. Column is just blank.
If I run my original one the column just says:
“Microsoft.ActiveDirectory.Management.ADPropertyValueCollection”
Get-ADUser -Filter * -Properties EmailAddress | select givenName, surName, EmailAddress, St | Export-CSV "C:\Scripts\Email_Addresses.csv" -NoTypeInformation
give that a go
ST column is blank
ahh missed the first part after properties
Get-ADUser -Filter * -Properties EmailAddress, st | select givenName, surName, EmailAddress, St | Export-CSV "C:\Scripts\Email_Addresses.csv" -NoTypeInformationPS C:\Users\mark.prior> Get-ADUser Elias.Manneh -Properties EmailAddress, st | select givenName, surName, EmailAddress, St givenName surName EmailAddress St --------- ------- ------------ -- Elias Manneh Elias.Manneh@blurb.com test
Mark is right. You have to “force” Get-ADUser to output the additional attribute State. So this works for me:
Get-ADUser -Filter * -Properties EmailAddress,State | select givenName, surName, EmailAddress, State | Export-CSV “C:\Scripts\Email_Addresses.csv” -NoTypeInformation
Next time to be able to help yourself you can try this and there you can see all the names of the possible attributes:
Get-ADUser $env:USERNAME -Properties * | Select-Object -Property *