Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################################
- #Author = Bered
- #Created 21/08/2018
- #Name = Create Office365 Dynamic Distro Group
- ######################################
- #Connect To Office365 (Do not Change)
- $UserCredential = Get-Credential
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Authentication Basic -Credential $UserCredential
- Import-PSSession $Session
- #Variables
- #New Group Name
- $NewGroup = "Name of New Group"
- #New Group Alias (No Spaces)
- $NewAlias = "Alias"
- #New Email Address
- #Create Dynamic Distribution Group
- New-DynamicDistributionGroup -Name $NewGroup -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (CountryOrRegion -eq 'Australia') -and (-not(ResourceType -eq 'Room')) -and (-not(ResourceType -eq 'Equipment'))} -Alias $NewAlias -DisplayName $NewGroup -PrimarySmtpAddress $NewEmail
Advertisement
Add Comment
Please, Sign In to add comment