Port3101.org : Your BES Connection

Port3101.org : Your BES Connection (http://www.port3101.org/index.php)
-   Scripts & Tools / Hints & Tricks (http://www.port3101.org/forumdisplay.php?f=12)
-   -   Command-line Script for User Manipulation via BUA (http://www.port3101.org/showthread.php?t=2146)

Otto 12-21-2009 01:18 PM

Command-line Script for User Manipulation via BUA
 
This has been tested on BlackBerry Enterprise Server 4.1.6 with BlackBerry User Administration Service 4.1.6, although it should be compatible or portable to any other version.

The scenario requested was to assign multiple users to a certain IT Policy in a multi-server domain. For example, I have 100 users who reside on one of five different BES servers and I want them moved from the Default policy to one named PasswordPolicy.

In this scenario, the input file of the 100 users will consist of the following format:
[email protected] BESSERVERNAME

While I'm leaving it up to you to gather this information and place it in this format, the script delimeter can be updated to accommodate your formatting needs.

bbusers.txt:
[email protected] NYCBB01
[email protected] NYCBB03
[email protected] NYCBB01

Command-line w/ variables:
FOR /F "tokens=1,2* delims= " %m IN ('type bbusers.txt') DO BESUserAdminClient.exe -p password -change -u %m -b %n -it_policy PasswordPolicy

Should you want to put this in a batch file, you will need to double-up the quotes:

FOR /F "tokens=1,2* delims= " %%m IN ('type bbusers.txt') DO BESUserAdminClient.exe -p password -change -u %%m -b %%n -it_policy PasswordPolicy

This can obviously be updated to perform any action within the BUA command-line, so have fun and feel free to update this thread with modifications, enhancements, etc.

:grandpa:

PSCArmstrSM 12-21-2009 02:25 PM

Thanks Otto, this will work for any future deployments I may have. :)

Otto 01-11-2010 04:01 PM

If within the same BlackBerry domain, the list for email addresses and BES instance names can be pulled with this SQL query:

SELECT U.MailboxSMTPAddr, S.ServiceName
FROM UserConfig U LEFT OUTER JOIN ServerConfig S
ON U.ServerConfigId = S.Id

hdawg 02-03-2010 11:50 PM

If you want to run this as a script and keep all the output from the command do as Otto says and save to a bat / cmd file ...

Then, at the command prompt execute:

script.bat > output.txt 2>&1

and the complete input/output of the script will be saved to output.txt :)


All times are GMT -4. The time now is 01:03 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.


SEO by vBSEO 3.3.2 PL2