2013-06-26

Add Multiple Owners to Distribution Group Existing Owners From CSV

##################################################################

# Add additional owners to a DG

#

# FileName: AddOwnersToDistGroups.ps1

# csv file has one column labeled groupname and additional columns named owner1, owner2, owner3... as needed

# http://social.technet.microsoft.com/Forums/exchange/en-US/f8e5d609-3173-4701-9c7f-3b99d25b30b5/apply-multiple-managedby-on-distribution-group

##################################################################

 

# $list=import-csv C:\AddDistributionGroupOwnerList.csv

$list=import-csv AddDistributionGroupOwnerListb.csv

 

Foreach ($i in $list) {

$grp=get-distributiongroup $i.groupname

write-host "Group: " $grp

write-host " "

$manage=$grp.managedby

write-host "ManagedBy: " $manage

write-host " "

$newuser1=get-user $i.Owner1

write-host "Owner1: " $newuser1

write-host " "

$manage=$manage+$newuser1

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus: " $manage

write-host " "

$newuser2=get-user $i.Owner2

write-host "Owner2: " $newuser2

write-host " "

$manage=$manage+$newuser2

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus2: " $manage

write-host " "

$newuser3=get-user $i.Owner3

write-host "Owner3: " $newuser3

write-host " "

$manage=$manage+$newuser3

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus3: " $manage

write-host " "

$newuser4=get-user $i.Owner4

write-host "Owner4: " $newuser4

write-host " "

$manage=$manage+$newuser4

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus4: " $manage

write-host " "

$newuser5=get-user $i.Owner5

write-host "Owner5: " $newuser5

write-host " "

$manage=$manage+$newuser5

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus5: " $manage

write-host " "

$newuser6=get-user $i.Owner6

write-host "Owner6: " $newuser6

write-host " "

$manage=$manage+$newuser6

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus6: " $manage

write-host " "

$newuser7=get-user $i.Owner7

write-host "Owner7: " $newuser7

write-host " "

$manage=$manage+$newuser7

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus7: " $manage

write-host " "

$newuser8=get-user $i.Owner8

write-host "Owner8: " $newuser8

write-host " "

$manage=$manage+$newuser8

$manage = $manage | Select-Object -Unique

write-host "ManageByPlus8: " $manage

write-host " "

Set-distributiongroup $grp -managedby $manage -bypasssecuritygroupmanagercheck

}

# End

##################################################################

 

Apply multiple managed-by on distribution group:

http://social.technet.microsoft.com/Forums/exchange/en-US/f8e5d609-3173-4701-9c7f-3b99d25b30b5/apply-multiple-managedby-on-distribution-group

 

Adding an Additional Distribution Group Manager/Owner:

http://byronwright.blogspot.com/2011/08/adding-additional-distribution-group.html

 

Updating the Managed By Property in Exchange 2010 Using PowerShell:

http://infrastructurehelp.wordpress.com/2011/08/18/updating-the-managed-by-property-in-exchange-2010-using-powershell/

1 comment: