Steps to install Powershell export AD users to CSV function#1 – Download and Unzip Export_ADUsers.zip #2 – Copy the folder Export_ADUsers (Contains the module) to the following locations: \Documents\WindowsPowerShell\Modules and \Program Files\WindowsPowerShell\Modules #3 – Open a Powershell prompt and run the command Import-Module Export_ADUsers If you receive any error, run Import-Module <path to module>\Export_ADUsers.psm1 #4. To get help type the command: Get-Help Export-ADUsers –Detailed #5 – To run an AD Report, run the command: Export-ADUsers -SearchLoc ‘OU=FromCSV,OU=TestUsers,DC=70411Lab,DC=com’ -CSVReportPath ‘C:\CSV’ -ADServer 70411SRV
Functionalities of Powershell export AD users to CSV function:#1 – Exports all user accounts in a specified OU, given you control #2 – Exported fields (CSV headers) are display in user friendly format, for example “First Name” instead of “GivenName” #3 – Displays exported Manager name in DisplayName format as against default AD Distinguised Name (DN) format #4 – Exports “Account Status” (Enabled or Disabled) #5 – Exports “Last LogOn Date” – Useful to determine “inactive” users based on your company policy I used the Powershell export AD users (Export-ADUsers) function in a project that required me to export these fields so that the project team can populate missing fields. Once the fields have been populated and sent to me, I updated the users (using the received CSV) using another PowerShell script, ImportADUsers. If you require ImportADUsers script, download it here (to be uploaded soon).
DISCLAIMER: This script is published on “As Is” basis. I will not take any responsibility for any damage this script might do to your production or test server environment. Please ensure that you test this properly in a non-production environment before running or scheduling the script in a production environment.