Script to grab some user info and handheld free memory
Posted 05-13-2010 at 04:05 AM by hdawg
A friend of mine wanted to take two scripts he had:
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!
- Obtained device free handheld memory
- Grabbed some user info from various tables (Name, email address, BES, Mode, OS Version, Password status (enabled / disabled) IT Policy name & applied time)
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
Total Comments 1
Comments
-
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!Posted 08-10-2010 at 04:52 PM by PSCArmstrSM












