Quantcast
Channel: Practical 365
Viewing all articles
Browse latest Browse all 546

PowerShell Script to Import Mail Contacts from a CSV File to Exchange

$
0
0

Import-MailContactsFromCSV.ps1 is a PowerShell script to automate the creation of Exchange mail contacts using a CSV file for input.

The current version of the script supports a CSV file containing the following fields, which are the minimum details required for creating a mail contact in Exchange:

  • Name
  • ExternalEmailAddress

The script looks for a file named Contacts.csv by default, or you can use the optional -CSVFileName parameter to specify your own file name. You can also set a default OU for contacts in the script, or use the -OU parameter to specify an OU.

Download the script from the TechNet Gallery or GitHub.

Example usage:

C:\Scripts\ImportContacts\>.\Import-MailContactsFromCSV.ps1
C:\Scripts\ImportContacts\>.\Import-MailContactsFromCSV.ps1 -CSVFileName externalcontractors.csv
C:\Scripts\ImportContacts\>.\Import-MailContactsFromCSV.ps1 -OU "exchangeserverpro.net/Company/Contacts"

If you are providing this script to a non-administrator to use, you can configure an RBAC custom role to limit their permissions to only allow them to create contacts in a specific OU, as demonstrated here.

     

Viewing all articles
Browse latest Browse all 546

Trending Articles