Tuesday, June 28, 2016

Add users to distribution list groups in Office 365 - Add users to distribution list groups in O365

Add users to distribution list groups in Office 365 - Add users to distribution list groups in O365


$UserCredential = Get-Credential

Set-executionpolicy unrestricted

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection



Import-PSSession $Session





 Add users in distribution group. Perform the following steps:

1. Create one test DG and run Add-DistributionGroupMember -Identity "testdg" -Member "user@domain.com" to add one member to group.

2. Run Get-DistributionGroupMember -Identity "testdg" and verify the user is added successfully.

3. Create one CSV file with members

4. Run Import-Csv pathfilename.csv|Foreach{Add-DistributionGroupMember -Identity "testdg" -Member $_.Members}


Set-executionpolicy unrestricted

-AllowClobber

$Session

get-mailbox

Get-DistributionGroup

Add-DistributionGroupMember -Identity "testdg" -Member user@domain.com

Get-DistributionGroupMember -Identity "testdg"
Members

Import-Csv pathfilename.csv|Foreach{Add-DistributionGroupMember -Identity "Staff" -Member $_.Members}
Distribution list

Add-DistributionGroupMember -Identity "testdg" -Member "fred@mcigc.ca"


Import-Csv C:\temp1\Staff.csv|Foreach{Add-DistributionGroupMember -Identity "testdg" -Member $_.Members}

Staff.csv
Members
user1@domain1.com
user2@domain2.com
user3@domain3.com




C:\temp1\dist\group1email-domain.com.csv

Import-Csv C:\temp1\dist\group1email-domain.com.csv|Foreach{Add-DistributionGroupMember -Identity "group1email@domain.com" -Member $_.Members}

Get-DistributionGroupMember -Identity "group1email@domain.com" Members

http://incoreporation.com       https://ca.incoreporation.com       http://wwebservices.ca 

Add external contacts to Office 365 - Add external contacts to O365

Add external contacts to Office 365 - Add external contacts to O365

With Powershell ISE

$UserCredential = Get-Credential

Set-executionpolicy unrestricted

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection



Import-PSSession $Session


Import-Csv pathfilename.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress}


Example:
Import-Csv C:\temp1\userlist.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress}


userlist.csv (has 2 columns)

Name ExternalEmailAddress

http://incoreporation.com       https://ca.incoreporation.com       http://wwebservices.ca 

Featured Posts

Exchange Online Limits - Office 365 Distribution group limits

Exchange Online Limits - Office 365 Distribution group limits What are Exchange Online Limits What are Office 365 Distribution group limi...