
I've written the following script with some Google and ScriptCenter work to check the filesize from a clients Exchange DB and compare this size to the manually set limit which can be found in Registry.
Code: Select all
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.0
'
' NAME: Filesize test script
'
' AUTHOR: T.T.H.Engels ,
' DATE : 1-11-2007
'
' COMMENT:
'
'==========================================================================
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
Dim objShell, Max, i
'============================Lees remote register =========================
strComputer = "SERVERNAME"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services\MSExchangeIS\SERVERNAME\Private-*cut*"
strValueName = "Database Size Limit in GB"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
WScript.Echo "Test123 : " & strValue'
Max = strValue
'==========================================================================
'=================================Set values================================
Max = Max -1
Int i
i = 0
'==========================================================================
'=================================Test=====================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.GetFile("\\SERVERNAME\disk$\MDBDATA\priv1.stm")
Set objFile2 = objFSO.GetFile("\\SERVERNAME\disk$\MDBDATA\priv1.edb")
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
file1 = objFile1.Size/1024/1024/1024
file2 = objFile2.Size/1024/1024/1024
i= file1 + file2
If i > Max Then
WScript.StdOut.Write statusBad
'Wscript.echo "Exchange database is to big: "&i
Else
WScript.StdOut.Write statusOk
'Wscript.echo "Exchange Database Priv1.stm is: "&file1
'Wscript.echo "Exchange Database Priv1.edb is: "&file2
End If
'==========================================================================
This script is implemented in such a way that it generates a mail to our company, what I want is that this mail doesn't only say:
"Scriptname
---------------
Status:Bad
Reply:
------------- "
I want there to be some kind of comment in the reply field.
Thanks a lot for any help

[edit]Hehe pretty stupid on my end indeed

Changed const statusBad = "scriptRes:Bad:" to
const statusBad = "scriptRes:Bad:This is my error"
This topic can be closed
