EXPORTING USERS WITH A POWERSHELL SCRIPT
The process of exporting to a .CSV file the users that are in an Active Directory domain with a PowerShell script is similar to the process of adding them with a script. The script required is much simpler however. This is what the script looks like:
The command Get-ADUser -Filter * -SearchBase looks for all users in the specified OU. The -Properties * command gets all the properties of each user.
The OU specified in this script is the OU where the users were bulk loaded to.
The |Select-Object command takes the previous command (using the pipe symbol) and passes it to the Select-Object command. This command selects the properties desired for export. You must use the active directory parameter names in the script to get the properties you want.
The properties selected in this script were chosen to reflect the properties of the users that were bulk loaded to the Active Directory domain such that the exported .CSV file looks similar to the .CSV file used to create the users.
The |export-csv -path takes the previous commands and exports the data to the path specified as a .CSV file.
Right click on the file and select Run with PowerShell to execute the script as shown in the next image.
The resulting exported .CSV file looks like the following:
A copy of the script used can be downloaded at the following link:
https://cmit220.ronniekupfer.com/wp/wp-content/uploads/2021/04/ExportUsers.txt
The two videos below show the process of bulk loading users from a .CSV file, assigning a login script to multiple users with minimal mouse clicks, and exporting users to a .CSV file.


