techdrive
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
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
}
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.
ASKER
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.
ASKER
Open in new window