03-12-2009 09:36 AM
03-12-2009 10:52 AM
Usage:
cscript /NoLogo MailboxSize.vbs EXCHANGE.domain.com JLN-MBX
Outputs:
JLN-MBX
-----------------------------
Storage : 29 MB
# Messages: 2098
The Script:
'This script logs on to a server that is running Exchange Server and
'displays the current number of bytes that are used in the user's
'mailbox and the number of messages.
' USAGE: cscript MailboxSize.vbs SERVERNAME MAILBOXNAME
' This requires that CDO 1.21 is installed on the computer.
' This script is provided AS IS. It is intended as a SAMPLE only.
' Microsoft offers no warranty or support for this script.
' Use at your own risk.
' Get command line arguments.
Dim obArgs
Dim cArgs
Set obArgs = WScript.Arguments
cArgs = obArgs.Count
Main
Sub Main()
Dim oSession
Dim oInfoStores
Dim oInfoStore
Dim StorageUsed
Dim NumMessages
Dim strProfileInfo
Dim sMsg
On Error Resume Next
If cArgs <> 2 Then
WScript.Echo ""
WScript.Echo "Usage: MailboxSize.cmd SERVERNAME MAILBOXNAME"
Exit Sub
End If
'Create Session object.
Set oSession = CreateObject("MAPI.Session")
if Err.Number <> 0 Then
sMsg = "Error creating MAPI.Session."
sMsg = sMsg & "Make sure CDO 1.21 is installed. "
sMsg = sMsg & Err.Number & " " & Err.Description
WScript.Echo sMsg
Exit Sub
End If
strProfileInfo = obArgs.Item(0) & vbLf & obArgs.Item(1)
'Log on.
oSession.Logon , , False, True, , True, strProfileInfo
if Err.Number <> 0 Then
sMsg = "Error logging on: "
sMsg = sMsg & Err.Number & " " & Err.Description
WScript.Echo sMsg
WScript.Echo "Server: " & obArgs.Item(0)
WScript.Echo "Mailbox: " & obArgs.Item(1)
Set oSession = Nothing
Exit Sub
End If
'Grab the information stores.
Set oInfoStores = oSession.InfoStores
if Err.Number <> 0 Then
sMsg = "Error retrieving InfoStores Collection: "
sMsg = sMsg & Err.Number & " " & Err.Description
WScript.Echo sMsg
WScript.Echo "Server: " & obArgs.Item(0)
WScript.Echo "Mailbox: " & obArgs.Item(1)
Set oInfoStores = Nothing
Set oSession = Nothing
Exit Sub
End If
'Loop through information stores to find the user's mailbox.
For Each oInfoStore In oInfoStores
If InStr(1, oInfoStore.Name, "Mailbox - ", 1) <> 0 Then
'&HE080003 = PR_MESSAGE_SIZE
' StorageUsed = oInfoStore.Fields(&HE080003)
StorageUsed = int(oInfoStore.Fields(&HE080003)/1024/1024)
if Err.Number <> 0 Then
sMsg = "Error retrieving PR_MESSAGE_SIZE: "
sMsg = sMsg & Err.Number & " " & Err.Description
WScript.Echo sMsg
WScript.Echo "Server: " & obArgs.Item(0)
WScript.Echo "Mailbox: " & obArgs.Item(1)
Set oInfoStore = Nothing
Set oInfoStores = Nothing
Set oSession = Nothing
Exit Sub
End If
'&H33020003 = PR_CONTENT_COUNT
NumMessages = oInfoStore.Fields(&H36020003)
if Err.Number <> 0 Then
sMsg = "Error Retrieving PR_CONTENT_COUNT: "
sMsg = sMsg & Err.Number & " " & Err.Description
WScript.Echo sMsg
WScript.Echo "Server: " & obArgs.Item(0)
WScript.Echo "Mailbox: " & obArgs.Item(1)
Set oInfoStore = Nothing
Set oInfoStores = Nothing
Set oSession = Nothing
Exit Sub
End If
' sMsg = "Storage Used in " & oInfoStore.Name
' sMsg = sMsg & " (bytes): " & StorageUsed
WScript.Echo ""
WScript.Echo oInfoStore.Name
WScript.Echo "-----------------------------"
WScript.Echo "Storage : " & StorageUsed & " MB"
' WScript.Echo sMsg
WScript.Echo "# Messages: " & NumMessages
End If
Next
' Log off.
oSession.Logoff
' Clean up memory.
Set oInfoStore = Nothing
Set oInfoStores = Nothing
Set oSession = Nothing
End Sub
03-12-2009 04:24 PM
We have a similar problem running EV 8. Our journaling mailbox often comes across a message that is corrupt and journaling fails until I remove the item. I created the following script to email me when our Journaling inbox has over 4000 items in it. Edit accordingly! Here is the link to the script: www-secure.symantec.com/connect/downloads/powershell-script-warn-if-ev-journaling-inbox-has-more-x-i...
03-13-2009 06:04 AM
Thank you both for your replies.
Sorry BigPhil I am unable to see your script when I click on the link. It states I do not have permission.
Regards,
Chris
03-13-2009 09:36 AM
The Downloads and Articles content posted by the users go into a moderation queue, from where the Community Managers will either approve or decline, based on the content's validity.
So Chris, I just published BigPhil's script. So check out the Downloads to see his script in there.
Thanks,
Swathi
03-13-2009 02:31 PM
I'm confused. EV already does this.. kind of.. EV will log an event if it spots a backlog of items. The default is set to 150,000 I believe you you can control it via a registry key
Location |
HKEY_LOCAL_MACHINE \SOFTWARE \KVS \Enterprise Vault \Agents |
Content |
DWORD |
the default like I say is 150,000 but you can set it to anything. Then when the journal task is scanning the mailbox(which is once per minute) then it will log the event.
Saying that if journalling is 'going fumny' then perhaps the jounal task isn't running.... However you shouldn't have to babysit the system, if there are issues call support to get to the root cause.
03-13-2009 08:35 PM
@The Dodo 2:
I didnt know about that key, but logging an event doesnt really do me any good. Having the email sent to me when the journaling fails does the trick so i can take care of the issue quickly. I agree that journaling shouldnt need to be babysitted, but at this point it does. I opened a case a month or so ago and had Paul working on it, and he says that the issue should be fixed in EV 8 sp1. so for the mean time, the powershell script has been quite valuable to me :)
03-14-2009 01:35 AM
Agreed with BigPhil,
Mike, having a event is ok, but these guys want to be notified, and with the amount of events in EnterpriseVault, you don't wanna sift through thousand's of events looking for one, just in-case you have an issue.
You want something to check constantly and alert you once you run into a problem. Not an alert in the EventLog