Export User List to CSV File from Active Directory using PowerShell

Active Directory Microsoft Windows

Here is a one liner to allow you to do this:

Get-ADUser -SearchBase “OU=Users,OU=Stuff,DC=domain,DC=co,DC=uk” -filter {enabled -eq $true} -properties GivenName,Surname,Department,Company,EmailAddress | select-object GivenName,Surname,Department,Company,EmailAddress | Export-CSV -path 'c:\export.csv'

Image Attribution: CHUTTERSNAP