This VBScrpit allows you to monitor the file size of a specific file and send email.
const bytesToKb = 1024
strFile = "C:\ABC.mdf"
set objFSO = createobject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile(strFile)
strFileSize = cint(objFile.Size / bytesToKb/ bytesToKb) & "mb"
strMsg = "Total Filesize for " & strFile & " is : " & strFileSize
'SEND EMAIL
Set myMail=CreateObject("CDO.Message")
myMail.Subject = "File Size"
myMail.From = "FROM EMAIL ADDRESS"
myMail.To = "TO EMAIL ADDRESS"
myMail.HTMLBody = strMsg
myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "SMTP SERVER"
myMail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
"Scripting" is basically giving sequential instructions to computer for doing specific things rather than doing manually. Sometimes we need to write a small and quick vbscript (.vbs), javascript(.js), batch file(.bat) or SQL script(.sql) to perform a short task, but we lack information or get confuse on where to start or which scrpit to write. In my BLOG, I will try to cover as many different scripts as possible that will be useful to everyone.
Showing posts with label Monitor. Show all posts
Showing posts with label Monitor. Show all posts
Wednesday, June 29, 2011
Subscribe to:
Posts (Atom)