Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Convert a dynamic distribution group to a regular distribution group in Exchange 2010
- #Sheldon Alman - sheldonalman at gmail.com
- $employees = Get-DynamicDistributionGroup "(dynamic group)" #This is the dynamic group to be read from
- $groupName = Get-distributiongroup "(regular group name)" -erroraction 'silentlycontinue' #This is the group to be modified. Continues if there are any errors encountered.
- #if the group exists, remove it and re-create it. If it doesn't exist, create it.
- if ( $groupname )
- {
- remove-distributiongroup "(regular group)" -Confirm:$false #disables confirmation of group removal.
- new-distributiongroup "(regular group)"
- set-distributiongroup "Employees" -customattribute11 "(whatever attribute you use to populate the group)"
- }
- else
- {
- new-distributiongroup "(regular group)"
- set-distributiongroup "(regular group)" -customattribute11 "(whatever attribute you use to populate the group)"
- }
- Get-Recipient -RecipientPreviewFilter $employees.RecipientFilter | export-csv C:\filename.csv #prints pertinent information about members of the group and exports it to csv
- import-csv C:\filename.csv | foreach { Add-DistributionGroupMember "(regular group)" -member $_.name }
- Remove-item C:\filename.csv -Confirm:$false #remove csv file if necessary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement