Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Looking for a script to set Delivery Restrictions to multiple groups

Posted on 2010-08-19
3
Medium Priority
?
551 Views
Last Modified: 2012-05-10
Hello,
i've come upon a request to have a mechnisem that will read a username from an input box and will add that user name to the Allowed Senders under the Messege Delivery Restrictions tab in Exchange 2007 of groups listed in a text file.
I think the value in adsi is "authOrig"?
is there any tool or script for this?
0
Comment
Question by:johnnyjonathan
[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
  • 2
3 Comments
 
LVL 2

Expert Comment

by:misterlupo
ID: 33483080
Do you have the Distinguished Names of your groups? If so, you could use the below script. If you want to modify too many I can modify the script to take an external file with group DNs

P.S.:
If you don't have it already, you need admod and adfind from Joe Richards
http://www.joeware.net/freetools/tools/adfind/index.htm
http://www.joeware.net/freetools/tools/admod/index.htm


@echo off
setlocal
set usrname=
set usrdn=
set /p usrname=Please enter the user name: 
if "%usrname%"=="" echo ERROR: No user name was provided. && goto :eof
for /f "tokens=*" %%a in ('adfind -default -f "&(objectclass=user)(objectcategory=person)(samaccountname=%usrname%)" -list distinguishedname') do set usrdn=%%a
if "%usrdn%"=="" echo ERROR: User name "%usrname%" cannot be resolved to a DN. && goto :eof
echo Resolving "%usrname%" to "%usrdn%"

admod -b "Your Group DN 1" "authOrig:+:%usrdn%"
admod -b "Your Group DN 2" "authOrig:+:%usrdn%"
admod -b "Your Group DN 3" "authOrig:+:%usrdn%"
admod -b "Your Group DN 4" "authOrig:+:%usrdn%"

Open in new window

0
 

Author Comment

by:johnnyjonathan
ID: 33495085
Hi,

No, I only have the display name and not the full DN. And they are groups that divided between several different OU's
0
 
LVL 2

Accepted Solution

by:
misterlupo earned 2000 total points
ID: 33509802
I assume you have the display name in a file. Unfortunally display name is not unique in the AD i.e. you can have two or more objects with the same display name. However the below script will search for objects with the given display name and doing the modification. It won't do anything if more than one group matches the given diplay name.

Before using it, please set the displaynamefile variable in the third line to the file that contains the display names.


@echo off
setlocal
set displaynamefile=
set usrname=
set usrdn=
set /p usrname=Please enter the user name: 
if "%usrname%"=="" echo ERROR: No user name was provided. && goto :eof
for /f "tokens=*" %%a in ('adfind -default -f "&(objectclass=user)(objectcategory=person)(samaccountname=%usrname%)" -list distinguishedname') do set usrdn=%%a
if "%usrdn%"=="" echo ERROR: User name "%usrname%" cannot be resolved to a DN. && goto :eof
echo Resolving "%usrname%" to "%usrdn%"

for /f "usebackq tokens=*" %%a in ("%displaynamefile%") do adfind -default -f "&(objectclass=group)(objectcategory=group)(displayname=%%a)" -dsq | admod -safety 1 "authOrig:+:%usrdn%"

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
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…
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…
Suggested Courses

598 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