Author Posts

April 12, 2017 at 8:45 am

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.

April 12, 2017 at 9:43 am

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

April 12, 2017 at 9:58 am

I tried just state but it doesn't work. Column is just blank.

April 12, 2017 at 10:01 am

If I run my original one the column just says:

"Microsoft.ActiveDirectory.Management.ADPropertyValueCollection"

April 12, 2017 at 10:05 am

Get-ADUser -Filter * -Properties EmailAddress | select givenName, surName, EmailAddress, St | Export-CSV "C:\Scripts\Email_Addresses.csv" -NoTypeInformation

give that a go

April 12, 2017 at 10:10 am

ST column is blank 🙁

April 12, 2017 at 10:40 am

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" -NoTypeInformation


PS 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

April 12, 2017 at 11:12 am

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 *