Solved

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

Posted on 2016-11-10
2
27 Views
Last Modified: 2016-11-10
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
Comment
Question by:Domenic DiPasquale
2 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 41881973
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
 

Author Closing Comment

by:Domenic DiPasquale
ID: 41882026
The example you provided worked perfectly. Thank you for your help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now