Why does this not work?

get-ADuser -filter * -property * 
    | select-object samaccountname, manager, secretary 
    | export-csv -path c:\temp\output.csv

The secretary field all returned

Microsoft.ActiveDirectory.Management.ADPropertyValueCollection

But this works:

get-ADuser -filter * -property * 
    | select-object samaccountname, manager, secretary 
    | out-file -filepath c:\temp\output.txt

For some reason Active Directory stores the Secretary field inside a pair of "{}" but the manager field is not enclosed in "{}". The "{}" messed up the export-csv. Is there a way to work around that?

The secretary field in Active Directory cannot be exported in CSV format. Why? All the values in the Secretary field is output as Microsoft.ActiveDirectory.Management.ADPropertyValueCollection instead of something like CN=Joe Smith,OU=Users,DC=ACME,DC=com.

Is it because of the Secretary field is internally stored with "{}"? Is there a way to strip that off?

0

There are 0 best solutions below