0
votes

I'm trying to backup the properties for a bunch of user accounts in Active Directory. I have no problem getting all the properties and exporting them to a CSV but all the mulit-valued properties just show as the type.

Without having to use a join on every property that is multi-valued (which is quite a few) does anyone know of a way to export all a users AD properties with their values?

I would use something like this to get all the properties and export them

Get-ADUser -Filter * -SearchBase 'DNOFSEARCH' -Properties * | Export-Csv C:\Temp\users.csv -NoTypeInformation

But again using that would not have actual values for mutli-valued properties (such as MemberOf)

1

1 Answers

0
votes

If you want to have CSV output and not have to address the nested arrays returned the answer is no. Export-CSV is not smart enough for that so you would need to use calculated properties @{Name="MemberOf";Expression={$_.memberof -join ";"}}.

If you wanted to not have to worry about that then Export-Clixml would be the suggestion. It is aware of objects and structure. I just don't know if your next process will be able to handle/parse that data.

Please avoid the use of -Properties * I cannot imagine a scenario where you would need to return all of an AD objects properties.