View Single Post
  #1 (permalink)  
Old 12-21-2009, 01:18 PM
Otto's Avatar
Otto Otto is offline
Proprietor
 
Join Date: Nov 2008
Location: Atlanta, GA
Posts: 2,032
Blog Entries: 14
Default 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:
emailaddress@domain.com 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:
user1@domain.com NYCBB01
user2@domain.com NYCBB03
user3@domain.com 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.

__________________
BCSA (4.1, 5.0) | BCSD (4.1, 5.0)

The views expressed by me on Port3101.org are my own and do not necessarily reflect the views of my employer.
Reply With Quote
Sponsored Links