Created
January 20, 2022 15:51
-
-
Save Subtixx/a2d4fc8b20f221cfd12f1166d58869dc to your computer and use it in GitHub Desktop.
Import Contacts to Office365
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(mandatory=$true)] | |
[string]$principal, | |
[Parameter(mandatory=$true)] | |
[string]$name, | |
[Parameter(mandatory=$true)] | |
[string]$email, | |
[Parameter(mandatory=$true)] | |
[string]$firstname, | |
[Parameter(mandatory=$true)] | |
[string]$lastname | |
) | |
Import-Module ExchangeOnlineManagement | |
#Connect-ExchangeOnline -InlineCredential | |
Connect-ExchangeOnline -UserPrincipalName $principal | |
New-MailContact -Name $name -DisplayName $name -ExternalEmailAddress $email -FirstName $firstname -LastName $lastname | |
Disconnect-ExchangeOnline -Confirm:$false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment