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
33 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
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 …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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