• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 64
  • Last Modified:

Assistance creating a powershell script that will export two User object attributes to an CSV file for a certain OU in active directory.

I recently needed to create 2 attributes for user objects in active directory. I would like to export the list of users within a certain organizational unit (OU) and the two attributes I created to an excel file or CSV, whatever powershell will support for exporting. Can anyone recommend a powershell script that I can work with to accomplish this task. Thank you for your time.
0
Domenic DiPasquale
Asked:
Domenic DiPasquale
1 Solution
 
oBdACommented:
You'll obviously have to replace Attribute1, Attribute2, and the OU path:
Get-ADUser -SearchBase "OU=SomeDeeperOU,OU=SomeOU,DC=contoso,DC=com" -Property Attribute1, Attribute2 |
	Select-Object -Property SamAccountName, DistinguishedName, Attribute1, Attribute2 |
	Export-Csv -Path C:\Temp\AttributeExport.csv -NoTypeInformation

Open in new window

0
 
Domenic DiPasqualeSystem / Network AdministratorAuthor Commented:
The example you provided worked perfectly. Thank you for your help!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now