Script for creating mail enabled distribution lists
Posted on 2008-10-14
I'm cleaning up AD mail enabled security groups. I want to remove their Exchange attributes so they are no longer mail enabled. However I would like to create the same name and append _DL . This way all AD objects with _DL will be mail enabled Global Ditribution lists. The members have to be copied over.
We now have in AD the Group "IT Dept" which is a mail enabled Global Security Group. We have 10 users in the member field added. So someone can write to "IT Dept@domain.com" and the 10 members get the email.
I would like to change it to:
"IT Dept_DL" and make it a Mail enabled Global Distribution Group and have all the 10 users copied over.
Because I have about 187 groups to do is there a way to have a script running that will do this instead of me doing it manually?
I found a script in the forum that enables me to do just what I want but there is no txt file that references all the groups.
Here it is:
set oldgroupdn=cn=it_test,ou=it Groups,dc=lab,dc=com
set newgroupdn=cn=it_test_DL,ou=it Groups,dc=lab,dc=com
dsadd group "%newgroupdn%" -secgrp no -scope g
dsget group "%oldgroupdn%" -members | dsmod group "%newgroupdn%" -addmbr
Where can I reference in the script a txt file with all the groups?