Solved

add lots of owners to distro mail enabled group

Posted on 2014-09-23
5
213 Views
Last Modified: 2014-09-24
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

0
Comment
Question by:techdrive
  • 3
  • 2
5 Comments
 

Author Comment

by:techdrive
ID: 40341906
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

0
 
LVL 14

Accepted Solution

by:
BlueCompute earned 500 total points
ID: 40341988
Unfortunately, you can't use Active Directory groups in those Exchange commandlets. You also can't set a security group as the manager from the Exchange Console.
I'd be inclined to just make it a 2-step process and use Get-Group to get the security group, get-members to extract the users from that group, then push those into a new CSV or just pipe into your existing script directly.
0
 

Author Comment

by:techdrive
ID: 40342012
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

0
 
LVL 14

Expert Comment

by:BlueCompute
ID: 40342027
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.
0
 

Author Comment

by:techdrive
ID: 40342308
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.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Read this checklist to learn more about the 15 things you should never include in an email signature.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question