?
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
Medium Priority
?
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

764 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