Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

add lots of owners to distro mail enabled group

Posted on 2014-09-23
5
Medium Priority
?
217 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Accepted Domain 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 >> Ac…

722 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