Delete old Blackberry Enterprise Server (BES) logs folder using vbscript

Scenarios :
While working daily on ticket, You have lots of stuff to work on, in Between you got a mail from Monitoring Team saying that, Team the disk space got full for log drive on one of the BES servers. On top of it your Lead asks – cant you guys put one script to do the automation here.

So finally here is that automation, which is gonna to delete old date logs automatically (Its all up to you for how many days you wanted to retain)

Solution:
=======================================
Examples:

This command will move logs older than 7 days from the folder “C:\Scripts\logs” where folder name value only contains numbers like “21112010″.

cscript //NoLogo c:\scripts\deleteBESLogFolders.vbs “C:\Scripts\logs” 7 move>> c:\scripts\BESLOg_Folder_Delete.log

This command will delete logs older than 7 days from the folder “C:\Scripts\logs” where folder name value only contains numbers like “21112010″.

cscript //NoLogo c:\scripts\deleteBESLogFolders.vbs “C:\Scripts\logs” 7 delete>> c:\scripts\BESLOg_Folder_Delete.log

——————————————————————————————————————————————————-

‘Copy and paste all the text below and create deleteBESlogFolders.vbs file.

‘Script: deleteBESlogFolders.vbs
‘Created By: Manish Girdhar
‘Date: 26 Nov 2010
‘Purpose: To delete/move folders from given path and all subfolders below this folder
‘ Usage: cscript DeleteBESlogFolders.vbs {DriveLetter:\FolderName} {#ofDays} {Delete or Move}
‘ or: cscript DeleteBESlogFolders.vbs {\\servername\FolderName} {#ofDays} {Delete or Move}
‘ Usage: cscript DeleteBESLogFolders.vbs c:\BES\log 3 d
‘ (deletes folders older than 3 days from the \BES\log file on drive C:)
‘Usage: cscript DeleteBESLogFolders.vbs c:\BES\log 3 m
‘ (moves folders older than 3 days from the \BES\log file on drive C: to C:\BES_Log_Backup)

Const BACKUP_FOLDER = “C:\BES_Log_Backup” ‘Change path folder to move log files
creatfold
Set ObjUsrInput = WScript.Arguments
FolderName =ObjUsrInput(0)
Days=ObjUsrInput(1)
Action=LCase(ObjUsrInput(2))
’1
if action = “delete” or action = “move” or action = “d” or action = “m” then
set fso = createobject(“scripting.filesystemobject”)
set folders = fso.getfolder(FolderName)
datetoday = now()
wscript.echo “”
wscript.echo “”
wscript.echo “”
wscript.echo “”
newdate = dateadd(“d”, Days*-1, datetoday)
wscript.echo “Current Date (Today):” & now()
wscript.echo “==================================================================”
wscript.echo “STARTING: Folders where date created is older than date :” & newdate & ” Will be deleted / Moved.”
wscript.echo “<>”
wscript.echo “”
route folders
wscript.echo “”
wscript.echo “COMPLETED: All Folders created older than date :” & newdate & ” are deleted / Moved.”
wscript.echo “<>”

‘=== Route Function Defined
sub route( byref folders)
set subfolders = folders.subfolders
‘==== For loop started
for each folder in subfolders
wscript.echo “”
‘Check if Date is in limit
if folder.datecreated < newdate then
””check if folder name is numeric
if IsNumeric(folder.Name) = true then
‘==============================M
”if action is MOve
if action = “move” or action = “m” then
wscript.echo “__________________________________________________________________________”
wscript.echo “Move folder :” & folder.path
wscript.echo “”
folder.move BACKUP_FOLDER & “\” & folder.Name
‘track if error
if err 0 then
DisplayErrorInfo
else
wscript.echo “”
wscript.echo “Folder Moved :” & folder.path
wscript.echo “__________________________________________________________________________”
end if ‘ tracking error
end if
‘================================M
‘End if Action is Move
‘===================== D
‘if Action is delete
if action = “delete” or action = “d” then
dim foldpath
wscript.echo “__________________________________________________________________________”
foldpath = folder.path
wscript.echo “Deleting folder :” & foldpath
wscript.echo folder.path
folder.delete
if err 0 then
DisplayErrorInfo
else
wscript.echo “”
wscript.echo “Folder Deleted :” & foldpath
wscript.echo “__________________________________________________________________________”
end if
End if
‘End of action Delete
‘======================D
End if
end if
on error resume next
next
‘====== for loop ended
set subfolders = nothing
set files = nothing
end sub
”’Function Route Ended
Else ’1

wscript.echo “Correct Action type not defined”

End if ’1

Sub DisplayErrorInfo
WScript.Echo “Error: : ” & Err
WScript.Echo “Error (hex) : &H” & Hex(Err)
WScript.Echo “Source : ” & Err.Source
WScript.Echo “Description : ” & Err.Description
Err.Clear
End Sub

sub creatfold
dim objFSO
set objFSO = createobject(“Scripting.FileSystemObject”)
if objFSO.FolderExists(BACKUP_FOLDER) then
else
objFSO.CreateFolder(BACKUP_FOLDER)
end if
End sub

Note: The Content has been taken from one of my favorite Blog title

Unable to Sync the Blackberry Contact field (Mobile 2) in MS Outlook

Issues :

one Day we came across with case, where a high profile users were loose lots of contacts & after checking with them we found “User’s Blackberry Device were not able to sync the Contact field (Mobile 2) from the Blackberry to MS Outlook.

Solution

There has no solution made so far, User has to save all the mobile 2 option to diffrent category, i.e Business No, Home No etc.

Note : Even the same issues happens with Nokia as well, why becasue in outlook we dont have the field for Mobile 2.

Unable to attach the file from the media card using emails on model 9800 Blackberry Torch Device.

Problem : User is not able to attach the file from the media card using emails on model 9800 Blackberry Torch Device.

“we found user device was content protection enabled, which usually organization use to protect the device, Specially this issues we came across to 9800 models only.

Workround : Just disabled the mdeia card encryption by going to the Media card properties.

Solution : This has been fixed in 6.0.0.287 (Bundle 870) and above. AT&T is not yet released the device software version 6.0.287 and users are required wait until the update is available.

Unable to view attchment icon & attachment on Blackberry Device for Excel

Problem : User complained that unable to see the attachment icon on the Device on a specific email

Solution : We asked user – is any application which is generating the excel file, After checking with the user we came to know, The excel file was getting generated in Office 2010 and saved in office 2003 compatiblity format.

Finally checking with RIM – This is not supported by the BES version 4.1.5, This issues got fixed in BES5 SP release 3

Free hosted BlackBerry service will be available for free to Office 365 customers.

Microsoft Online Service has announce that whoever would be going for Online Office 365 Hosted Solution,  Microsoft will be providing free Blackberry Services for them.

“Blackberry-maker Research in Motion (RIM) will introduce a new BlackBerry cloud-based service later this year. The service will be hosted, licensed and supported by RIM who have committed to offer their new BlackBerry cloud based service for Exchange Online starting at $0 per user per month.”

http://community.office365.com/en-us/b/microsoft_office_365_blog/archive/2011/03/16/office-365-and-blackberry.aspx

The Purpose of the Blackberry Solution

The blackberry solution is designed for the people who are on the go – wanted to be connected with the People and information.

 The Blackberry Enterprises Solution is Designed to provide Blackberry smartphone users with wireless access to a full suite of productivity enhancing tools, including the Following stuff below.

  1. Email messaging
  2. Organization Applications
  3. Organization intranet and internet access
  4. Phone Functionality
  5. Organizor Data
  6. MMS Messaging and SMS Text Messaging.

About RIM [Blackberry]

Research In Motion (RIM), is the designer and manufacturer of the award-winning BlackBerry smartphone, used by millions of people around the world. The company also creates software for businesses and the operating system that allows the BlackBerry smartphone to provide mobile access to email, IM, apps, media files, the Internet and many more.

Fast Facts about RIM

  • Founded in 1984
  • Headquarters in Waterloo, Ontario, Canada
  • Offices in North America, Asia-Pacific and Europe
  • Launched the BlackBerry smartphone in 1999

Duplicate calendar entry in the BlackBerry Smartphone.

Issues : 

Duplicate calendar entry in the BlackBerry Smartphone.

Note: Ensure that there is no Duplicate Calendar entry in the Outlook, if that’s the case then check with Messaging Team.

Solution a)
To remove the duplicate entries on the BB calendar please perform the below steps.From the BlackBerry Smartphone Home screen, click Options.
1. Click Advanced Options > Service Book.
2. Locate the Desktop [CICAL] service book. If it is available, complete the steps below. If it is not available, complete the steps in the No Desktop [CICAL] service book section in this article.
3. Highlight the Desktop [CICAL] service book.
4. Open the menu and click Delete to remove the Desktop [CICAL] service book.
Open the menu and select Undelete or Send the Service Book from the Server by selecting the user.
After that need to perform Solution b to permanent fix.

Solution b)
Remove Microsoft Exchange Cache Mode from the delegate’s Microsoft Outlook profile.
For Microsoft Outlook 2003, complete the following steps:
1. Go to Tools.
2. Select Email Accounts.
3. Under E-mail, select view or change existing email accounts and click Next..
4. Click the Change button with the Microsoft Exchange Server highlighted.
5. Under the Microsoft Exchange Server, uncheck Use Cached Exchange Mode.
6. Click Next and then Finish.
For Microsoft Outlook 2007, complete the following steps:
1. Go to Tools.
2. Select Account Settings.
3. Highlight the Microsoft Exchange Server and click Change.
4. Uncheck Use Cached Exchange Mode.
Click Next and then Finish.

After that  perform Solution C for reloading the caleander.

Solution c)

Reloading the calendar from the server

1. Open the calendar application on the Smartphone.
2. Press the Menu key and highlight Options.
3. Select the calendar to be reloaded, e.g. “Desktop” for a BlackBerry Enterprise Server enabled Smartphone.
4. With the calendar highlighted type rset
5. Click yes when asked to reload the specific calendar to continue.

If issues still Persist then or this duplicate calendar issues is occuring very frequent then the below steps need to performed.

Solution d)
Check for the Calendar Delegation for the user and Ensure Delegated users are also having the same build and Outlook Version. Ask user to share the Outlook Version Screen shot of each delegates.

Caller ID information for incoming call – not showing in the Blackberry Device

Issue:
Caller information does not display on the incoming call screen when the BlackBerry Handheld is holstered and locked. Users are not able to see caller information on their Blackberry devices because Content Protection is enabled for the Address Book application.

Resolution:  in Most of the cases we have seen this issues appears, because on the server side CP is enabled. So we just need to disabled the CP, the steps are below.

To disable Content Protection for the Address Book application, complete the following steps:
For BlackBerry Device Software 4.2 to 4.7:

From the Home screen of your BlackBerry handheld
Click Options
Select Security Options
Select General Settings
In the Content Protection section, scroll to either Include Address Book or Include Contacts and toggle it to No.
For BlackBerry Device Software 5.0:
From the Home screen of your BlackBerry handheld
Click Options
Select Security Options.
Select Encryption.
Select Include Contacts and toggle it to No.