Powershell Get-ADuser Company and different Attributes to CSV

Hi,

get-aduser -properties Company -filter {Company -like "*Company-Name*"} | select SamAccountName,surname,givenname,extensionattribute13 | export-csv 'c:\excel\User_company.csv' -Delimiter ';' -NoType -Encoding UTF8 

With this oneliner above i like to get all user of the company and some attributes. Unfortunately the

extensionattribute13 receives nothing to the csv. what can i do? Should i use the -expandproperty extensionattribute13 parameter?

with this line i’m getting my result but these are more then 800 Users and i needed in the excel sheet.

Get-ADUser crietzler -Properties extensionattribute13 | select -expandproperty extensionattribute13

Could anybody help me?

Thanks in advance.

3 Spice ups

Can you post a screenshot of what you see when you run the command below?

get-aduser -properties Company -filter {Company -like "*Company-Name*"} | select extensionattribute13 

If you want a property that is not part of the default output, you will need to specify it with the -Properties parameter.

get-aduser -properties Company,extensionAttribute13 -filter {Company -like "*Company-Name*"} | select SamAccountName,surname,givenname,extensionattribute13 | export-csv 'c:\excel\User_company.csv' -Delimiter ';' -NoType -Encoding UTF8 

Nothing only
Extensionattribute13
—————————-/

Do any of the users have data populated in extensionAttribute13?

This should work.

Is that the actual name of the attribute? Check if there is a typo in your code or in the attribute itself.

You can use this to double check:

Get-Aduser yourUsername -properties * | Get-Member