Some of my fields in my CSV file are showing up as ADPropertyValueCollection
Is there anyway to get all the values of the collection and store them into my CSV?
showInAddressBook
Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
The code I used is
Get-ADUser -Filter * -Properties * | export-csv -path c:\temp\userexport.csv
Please don't do
-properties *
unless you really need every property, which you apparently don't. It takes much longer to execute if you're dragging down every property in a user.You don't need the quotes between all of the properties in your
Select
statement. Also, you had a backtick in front ofName
. The::join
in the sample didn't work for me either. This works:These days I actually recommend exporting to JSON if you have multivalued attributes you're going to reprocess later. Obviously this works if you're querying multiple users as well.
Then you import JSON from file into an object (it's a PSCustomObject) and process that. PSCustomObjects are handy for slicing and dicing.
One way would be to | it to a select, and specify each property name. For multi-valued properties, do this: