Arete
Arete

Reputation: 1004

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?

Upvotes: 2

Views: 31639

Answers (2)

Deivid Cowers
Deivid Cowers

Reputation: 11

You need to use the MMC.

https://www.technipages.com/active-directory-schema-snap-in

  1. Select the Start button, then type CMD.
  2. Right-click on Command Prompt and select Run as Administrator.
  3. Type the following, then press Enter:
    regsvr32 schmmgmt.dll
    
  4. You should receive a message that registration succeeded.

Now, you should be able to add the snap-in using these steps:

  1. Hold the Windows Key and press R to bring up the Run box.
  2. Type mmc, then press Enter. The Microsoft Management Console opens.
  3. Select File > Add/Remove Snap-In.
  4. Select Active Directory Schema, then select Add. 5-Select “OK“.

The Active Directory Schema option will now be available to use.

Then you select the folder inside that says Class, and you need to look for User class. Click on it, and it will show all of your attributes; then you only need to export the list doing right-click on the class.

NOTE: I don't know how to determine the writable attributes from this, but maybe you will figure when you will try it.

Upvotes: 1

Ashigore
Ashigore

Reputation: 4678

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"

Upvotes: 4

Related Questions