powershellactive-directory

Export all attributes and values of a user in Active Directory


In "Active Directory Users and Computers" on Windows I have the ability to view a list of all attributes and their values.

I need to somehow export this list of values so that I have one column with the attribute name and one column with the value, just like in the picture.

enter image description here

I tried to do this with PowerShell

Get-ADUser smith -Properties * -value | Get-Member -MemberType property | Out-File "filename.csv"

But this just gives me a list of the attribute name, not the values.

How can I export everything in the attribute editor to a file with PowerShell?


Solution

  • I'm not sure how you ended up with that code, as it contains a lot of unnecessary additions that end up with you not having what you want.

    All you need to do is

    Get-ADUser smith -Properties * | Out-File "filename.csv"