Badges

Types

Formats

Show Only

EmailLogs.vbs
https://mreschke.com/213/emaillogsvbs
This script will email a log file (or any file specified) only if the file is under a certain size. If the file is over that size limit, it will still email, but no log will be attached. See Script does not use parameters, everything is hard coded, so just call the .vbs. Great in a scheduled task to email you a daily log file. Can easily be modified with parameters for various purposes. Option Explicit Dim iMsg, iConf, Flds, pc 'Email vars Dim logFile, maxLogSize 'Log vars Dim FSO, File, strSiz...
|
post #213 by mreschke Nov 10th 2010 (2636 views)
StartStopProc.vbs
https://mreschke.com/212/startstopprocvbs
This script will start or stop a process by process name. If the process is already running with a start is called, it will not start a duplicate. The benefit is that it will NOT start the script twice. So if you want to ensure an application is running all the time, just setup a scheduled task to run this script every 10 minutes, if the .exe dies it will start it, if the .exe is still running, it won't start a duplication. REM Example Script.bat (note I path to the .exe dir so it runs in its l...
|
post #212 by mreschke Nov 10th 2010 (2422 views)
DeleteOldFiles.vbs
https://mreschke.com/211/deleteoldfilesvbs
This script will recursively delete all files in every subfolder older than X days. Will not delete any folders, just files. I create a batch file and call the vbs script for any directory I need purged. rem Use this script to clean up any old files automatically. rem This .bat will be called weekly from a scheduled task, and will rem call the d:\production\batch\generic\DeleteOldFiles.vbs with directory/day parameters rem the commands will not run simultaneously (unless they begin with start)...
|
post #211 by mreschke Nov 10th 2010 (4904 views)
ProcessManager.vbs
https://mreschke.com/58/processmanagervbs
Very handy VBScript, watches a process during a certian time interval, if it's running good, if not start it unless it's beyond the time interval, then kill it. Good if you want a program to run between 1pm-5pm but not the rest of the time. Hook this up to a scheduled task and exec every 10 minutes to ensure app is running or app is dead. IF the process is down in the time frame, it will start it, and send out an email that it was down. See You must edit the script below. Must set the process t...
|
post #58 by mreschke May 6th 2008 (3146 views)
VBScript File List
https://mreschke.com/56/vbscript-file-list
<p>This script accepts a path (ex: c:\temp\*.* or c:\*.txt) and builds a 1 dimensional array of the files that match the directory/wildcard.</p>
|
post #56 by mreschke May 6th 2008 (2955 views)
VBScript Snippets
https://mreschke.com/55/vbscript-snippets
dim filesys set filesys=CreateObject("Scripting.FileSystemObject") If filesys.FileExists("c:\sourcefolder\anyfile.html") Then filesys.MoveFile "c:\sourcefolder\anyfile.html", "c:\destfolder\" End If Get the last modified date and time of a file Private Function FileDateTime(byVal pathname) Dim objFSO, objFile On Error Resume Next Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(pathname) If Err Then FileDateTime = Null Else FileDateTime = CDate( objFil...
|
post #55 by mreschke May 6th 2008 (2898 views)
VBScript Basics
https://mreschke.com/46/vbscript-basics
function test() dim a a = "Hi there" test = a 'This returns a end function Option Explicit 'Check a process, restart it and send email alert, or kill process depending on time window 'Original script created by NetRes 'Modified by mReschke 2008-04-28 (converted to functions, actions change by time, email enhancements, globals, generic process killer) 'If process is NOT running between start/endHour then restart it and send an email if sendEmail = true 'If process is running outside of start/end...
|
post #46 by mreschke Apr 29th 2008 (2989 views)
Send Email using VBScript
https://mreschke.com/45/send-email-using-vbscript
This is just a function snippet, sends an email with attachments, must manually edit function with email and attachment parameters. Used in and Sub SendLogEmail() Set pc = CreateObject("Wscript.Network") Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields Const schema = "http:schemas.microsoft.com/cdo/configuration/" dim emailBody Flds.Item(schema & "sendusing") = 2 Flds.Item(schema & "smtpserver") = "xxx.xxx.xxx.xxx" Flds.Item(schema & "...
|
post #45 by mreschke Apr 29th 2008 (5821 views)
Showing 1 to 8 of 8 results