PowerShell cmdlets to work with Distribution group in Exchange 2007 - Becareful the difference between AD and Exchange
Here are a few cmdlets to work with distribution group in exchange 2007
New-DistributionGroup – Creates a new distribution group
Set-DistributionGroup – Set Properties on a distribution group
Get-DistributionGroup – Retrieves properties of a distribution group
Remove-DistributionGroup – Deletes a distribution group
…
If you want to work with DynamicDistributionGroup, just replace DistributionGroup with DynamicDistributionGroup.
As always you can get details by get-help cmdlet -full
How you add member(s) to an existing distribution group?
Add-DistributionGroupMember -Id ITOps -Member ‘yli’
What if you want to grant someone manage a distributiongroup membership permission?
Set-DistributionGroup -id ITOps -ManagedBy ‘Yli’
That actually doesn’t work. It is the same as you use Set-Mailbox cmdlet to set Exchange specific properties and the Set-User cmdlet to set basic Active Directory properties, Here you need to use Set-Group because this action creates a link to another AD account who will manage the group! So the below cmdlet will accomplish the above task!
Set-Group -id ITOps – ManagedBy ‘yli’
I will add a bonus here – what if you change your mind and want to remove someone the manage distributiongroup permission?
Set-Group -id ITOps – ManagedBy $null