Solved

add lots of owners to distro mail enabled group

Posted on 2014-09-23
5
204 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
A procedure for exporting installed hotfix details of remote computers using powershell
In this video we show how to create an Address List 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 Organization >> Ad…
how to add IIS SMTP to handle application/Scanner relays into office 365.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now