David Williams Technical


Endpoint Management & Deployment – MDM Management – Scripting – Cyber Security Engineering – Application Configuration & Deployment

Active Directory OU Export to CSV File

This command will allow you to export a list of devices in specific OUs to a CSV file.

Open PowerShell as an Administrator and run this command:

Get-ADComputer -SearchScope Subtree -SearchBase “OU=Room,OU=Building,OU=Staff,OU=Workstations,DC=Domain,DC=co,DC=uk” -Filter * -Properties Name | Export-Csv -Path “c:\Exported_Device_List.csv”

You will need to specify the properties of the OU you want to export. The command above is an example. You will need to change everything in bold that matches your environment in order for this command to work.

Note: you can export just a single OU container or an entire container if for example you want to see every device in an entire building. You merely need to configure the script accordingly.