Skip to main content
AK - Technology

Main navigation

  • Home
  • Knowledge Base
  • Services
  • Contact

Breadcrumb

  1. Home

Exchange 365 Remote Power Shell - Dynamic Distribution Groups

run PS as an admin

Set-ExecutionPolicy RemoteSigned

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

Import-PSSession $Session

to disconnect:
Remove-PSSession $Session

Get-DistributionGroupMember -Identity groupname

Set-DynamicDistributionGroup -Identity "groupname" -ConditionalCompany "PAA" -IncludedRecipients MailboxUsers -ConditionalDepartment "departmentname"

Set-DynamicDistributionGroup -Identity "groupname" -RecipientFilter {(RecipientType -eq 'UserMailbox') -and (Company -eq 'PAA') -and (Department -eq 'Accounting')}

wildcard cannot be used as a first character (?!!!)

$members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
Get-Recipient -RecipientPreviewFilter $members.RecipientFilter

News

  • Multi‑Factor Authentication Is No Longer Optional
  • Useful Paid Tools
  • Section 2 of Secure Network Act
  • Tecsun Electronics
  • 3 Samsung Galaxy Phones - end of support

ak technology service 
708-717-4645