Link to home
Start Free TrialLog in
Avatar of techdrive
techdriveFlag for United States of America

asked on

add lots of owners to distro mail enabled group

I have a script to export users from existing distro lists and it works fine. I am now trying to import some users and groups into distro lists. I did a search and found this script but trying to find what is an easy way to incorporate getting groups as well as users. This appears to only import users but not groups.

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

Foreach ($i in $list) {
 $grp=get-distributiongroup $i.groupname
 $manage=$grp.managedby
 $newuser=get-user $i.user
 $newmanage=$manage+$newuser
 Set-distributiongroup $grp -managedby $newmanage -bypasssecuritygroupmanagercheck
 }

Open in new window

Avatar of techdrive
techdrive
Flag of United States of America image

ASKER

This works excellent for users but not for groups. I have even tried the following


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

Foreach ($i in $list) {
 $grp=get-distributiongroup $i.groupname
 $manage=$grp.managedby
 $newgroup=get-adgroup $i.group
 $newmanage=$manage+$newgroup
 Set-distributiongroup $grp -managedby $newmanage -bypasssecuritygroupmanagercheck
 }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Member_2_6515809
Member_2_6515809

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I see so something like this should work

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

Foreach ($i in $list) {
 $grp=get-distributiongroup $i.groupname
 $manage=$grp.managedby
 $newgroup=get-group $i.group
 $newmanage=$manage+$newgroup
 Set-distributiongroup $grp -managedby $newmanage -bypasssecuritygroupmanagercheck
 }

Open in new window

Avatar of Member_2_6515809
Member_2_6515809

Nope, I wouldn't have thought so. Are your AD groups mail-enabled? If not, they simply can't be used like this. You'll need to mail-enable them first, then you should be able to set them as a manager. You can only mail-enable Universal groups, standard Active Directory groups *can't* do what you're trying to do here.
Make sense and I also realized that in 2013 that global groups cannot be added as owners to distribution groups. They all have to be universal.