Welcome to Port3101.org : Your BES Connection Mark forums read | View Forum Leaders
Port3101.org : Your BES Connection



Rate this Entry

Script to grab some user info and handheld free memory

Submit "Script to grab some user info and handheld free memory" to Digg Submit "Script to grab some user info and handheld free memory" to del.icio.us Submit "Script to grab some user info and handheld free memory" to StumbleUpon Submit "Script to grab some user info and handheld free memory" to Google
Posted 05-13-2010 at 04:05 AM by hdawg

A friend of mine wanted to take two scripts he had:
  1. Obtained device free handheld memory
  2. Grabbed some user info from various tables (Name, email address, BES, Mode, OS Version, Password status (enabled / disabled) IT Policy name & applied time)
and wanted them combined into a single query. The difficult thing is that to get free handheld memory you need to do some converting and parsing of data from the SyncDeviceMgmt table in the BlackBerry Configuration Database.

So what we do is grab the free device memory information and throw it into a temporary table, and then use that data to go into our other script. The cool thing here is that we create a table in memory which is good for the life of the script, and then it is gone. So it is there for us when we need it

For those of us that find it challenging to extract info out of the BAS, scripts like this definitely help out!

Code:
DECLARE FreeHandheldMemory TABLE (
UserConfigId int,
FreeHHBytes int)

INSERT INTO FreeHandheldMemory (UserConfigId, FreeHHBytes)
SELECT UC.Id, convert(int, substring(SDM.data, patindex('%3>%',SDM.Data)+2, patindex('%</t3>%',SDM.data) - patindex('%3>%',SDM.Data) - 2))
FROM SyncDeviceMgmt SDM, UserConfig UC
WHERE SDM.TableId ='5' and SDM.UserConfigId = UC.id

SELECT  UC.DisplayName, UC.MailboxSMTPAddr, SC.ServiceName, vUCS.ModelName, vUCS.AppsVer, FHHM.FreeHHBytes, vUCS.PasswordEnabled, vUCS.ITPolicyName, vUCS.ITPolicyTime
FROM   ITPolicyStatus ITPS, UserConfig UC, ServerConfig SC, vUserConfigStats vUCS, FreeHandheldMemory FHHM
WHERE ITPS.UserConfigId = UC.Id AND UC.ServerConfigId = SC.Id AND UC.Id = vUCS.Id AND UC.Id = FHHM.UserConfigId
ORDER BY UC.DisplayName
Posted in Tips & Tricks
Views 4903 Comments 1 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    Howie, I had to make a couple of corrections to get this query to fly.

    DECLARE @FreeHandheldMemory TABLE
    (
    UserConfigId int,
    FreeHHBytes int
    )

    INSERT INTO @FreeHandheldMemory ( UserConfigId, FreeHHBytes )

    I changed refs to FreeHandheldMemory to @FreeHandheldMemory and added spaces between the parenthesis. Without these, it threw an error on the TABLE declaration.

    Carry on!
    permalink
    Posted 08-10-2010 at 04:52 PM by PSCArmstrSM PSCArmstrSM is offline
 

All times are GMT -4. The time now is 07:10 AM.
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.


 

Content Relevant URLs by vBSEO 3.3.2 PL2