Wednesday, November 5, 2008

BESadmin and ‘Send As’ Right

If you are working with BES (BlackBerry Enterprise Server) you can get a problem, when users cannot send emails from their Blackberry. And, I guess you already familiar with a “Send As Permission” problem :).

So, I created a script, that allows set all neccesasry right to the BESADMIN account. When you run script, you should provide an OU, where the particular user exist and user’s email address.

NOTE: In my script I used linex.exe and dsacls.exe. Just use Google to download those very POWERFUL tools ;)

@echo off
SET Tools=C:\Tools
SET TEMP=C:\TMP

SET SOU=
SET BES=
SET ou4user=
SET BES-USER=

DSQUERY OU domainroot > %TEMP%\ou.txt
%Tools%\linex -n < %TEMP%\ou.txt

SET /p SOU=”Please type # of OU where the user located: “
SET /p BES=”Please type user’s email address: “

FOR /F “TOKENS=* delims==,OU” %%a in (’%Tools%\LINEX -l %SOU% ^<%TEMP%\OU.txt’) do set ou4user=%%~a

FOR /F “TOKENS=2 delims==,” %%a in (’dsquery * “%ou4user%” -attr mail distinguishedName^|find /i “%BES%”‘) do set BES-USER=%%~a

@echo “%BES-USER%”

dsacls “CN=%BES-USER%,%ou4user%” /G “%USERDOMAIN%\BESADMIN:GR”
dsacls “CN=%BES-USER%,%ou4user%” /G “%USERDOMAIN%\BESADMIN:CA;Send As”

No comments: