BES 5.0 CAL Populator - via Send Keys script

We are bringing on a new client, who had their own BES environment. As part of the process, we are rolling over their 1000+ CALs into our existing BES 5.x environment. Unfortunately, RIM does not have a nice pretty way to repopulate this information, unless your situation is ideal; ours is not.

This leaves me with 2 alternatives. Hand type each CAL into our BES server, and click the + button. Since it's a web page and not a GUI like 4.x versions, this means type 6 characters, tab, 6 more, tab, 6 more, etc.. OUCH! Painful!!

Hence, option 2, script to do the Send-keys function. I open my BES 5 management console, scroll down to the license page and click in the box where the first portion of the key will go. Now, I run my script (prepopulated with keys from the text file):

BESCAL-123456-7890AB-CDEFGH-IJKLMN-OPQRST
BESCAL-123456-7890AB-CDEFGH-IJKLMN-OPQRSV
BESCAL-123456-7890AB-CDEFGH-IJKLMN-OPQRSW

Clicking OK on the script will type in one full CAL and hit ENTER, which submits the key. I need to click back in the first square, and now click OK or Cancel. If I hit CANCEL, it doesn't stop the script, it marks the key as failed to input. (see missed txt file in code). OK submits as if the last entry was OK. The script will loop through all NNN entries in my text file then close.

Note: No troubleshooting is implied by this script. It will not confirm the CAL is valid. It will not confirm that you are clicked in the right spot. It will send the CAL to where ever you are clicked. By default the BES mgmt console is on the very top of the page in the first box... This script, WILL save you having to enter all your CALS by hand. Just pay attention to what you are doing.

' SendKeys.vbs
'
Populate BES Cals into BES 5. web console.
' -----------------------------------------------------'
Option Explicit

dim objfso, objtextfile, objNewFile
dim strNextline, arrKey
Dim objShell, intCount, calcount
dim buttons, answer, strSubject, previouskey

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("d:\bin\keys.txt", 1, false)
Set objNewFile = objFSO.OpenTextFile("d:\bin\keys-missed.txt",2 , true)

Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "%{tab}"  ' switch to IE

buttons = 0


do while objTextFile.AtEndOfStream <> true
        strNextLine = ObjTextFile.readline
        strSubject = "click on the first field and click OK" & chr(13) & strNextLine
        if len(previouskey)>1 then
                strSubject = "prev:"&previouskey &chr(13) &strSubject
        end if
        answer = msgbox(strSubject, buttons, "BES Key Updater")
        if answer = 2 then
                objnewfile.writeline PreviousKey
        end if
        arrkey = split(strNextLine,"-")
        objShell.SendKeys "%{tab}"  '
switch to IE
        WScript.Sleep 150

        objShell.SendKeys arrkey(0)
        objShell.SendKeys "{TAB}"
        objShell.SendKeys arrkey(1)
        objShell.SendKeys "{TAB}"
        objShell.SendKeys arrkey(2)
        objShell.SendKeys "{TAB}"
        objShell.SendKeys arrkey(3)
        objShell.SendKeys "{TAB}"
        objShell.SendKeys arrkey(4)
'       WScript.Sleep 1500
        objShell.SendKeys "{TAB}"
        objShell.SendKeys "{ENTER}"
        PreviousKey = strNextLine
        buttons = 1      '
ok + cancel
Loop
objNewFile.close

WScript.Quit
' End of Example SendKeys VBScript

Comments

clicking ok rules!

it was fun!

Better than the alternative

Still have 600 cals to enter...

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <blockquote> <center> <hr> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal6>, <html>, <java>, <javascript>, <php>, <posh>.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.