Export Users From Active Directory Using PowerShell - DuoCircle

  1. DuoCircle
  2. Phishing Protection
  3. Getting Started - Email Security
Support Categories
  • General
  • SMTP Relay
  • Email Archiving
  • Internal
  • Message Management & Quarantine
  • Account Management
  • Phishing Protection
  • Legal
  • Email Forwarding
  • Abuse Desk
  • Tenant Migration
  • MX Backup
  • AutoSPF
  • Spam Filtering

Related Articles

Export users from Active Directory using PowerShell

Modified on: Thu, 24 Sep, 2020 at 8:55 PM

You can export users from Active Directory using PowerShell. The cmdlet below exports a complete list of my company’s users to a csv file.

Get-ADUser -Filter 'Company -like "Alpha*"' -Properties * | Select -Property EmailAddress,GivenName,Surname,DisplayName,Title,Department,Office,OfficePhone,MobilePhone,Fax,StreetAddress,City,State,PostalCode,Country | Export-CSV "C:\\ADusers.csv" -NoTypeInformation -Encoding UTF8

Get-ADUser cmdlet can either pull only one user from Active Directory, using –Identity parameter, or it can pull many users at once with –Filter or -LDAPFilter parameters. In this example, I use the filter to export all users who have the Company AD field starting from “Alpha”. Thanks to that, I will get only the users I want, without e.g. Healthmailboxes which would appear if I used “-Filter *”, instead.

The cmdlet creates ADusers.csv file on the C drive. If you want to use this file to import users into Office 365, you need to take 2 easy steps. First, you have to substitute the first row with the right headings from the file mentioned in step 4 above. Then, go to edit > replace and remove all quotation marks:

The cmdlet exports all AD properties used in Office 365 import file, so there is no need to spend any time copying and pasting columns like it was the case in previously described methods.

Did you find it helpful? Yes No

Send feedback Sorry we couldn't be helpful. Help us improve this article with your feedback.

Looking for DuoCircle Email Security Solutions?

  • Email Security Services
  • Phishing Protection
  • Hosted SMTP
  • Email Threat Protection
  • Spam Filtering Service
  • Email Forwarding Service
  • Email Archive Solutions
  • Email Backup MX
  • Email Continuity Service
  • Hosted Email
  • SPF Permerror
  • SPF Checker
  • MSP Partner Program

Tag » Active Directory User List Export Csv Powershell