Solved

add lots of owners to distro mail enabled group

Posted on 2014-09-23
5
214 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this video we show how to create a Distribution Group 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 Recipients >>…
To show how to create a transport rule 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 >> Rules tab.:  To cr…

752 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