I need a script that will check to see if a text file is on a server at a specific location: if it is, then it needs deleted, else an email notification needs sent. Sounded easy ..
This scipt does delete the file if it's there, but if it's not there, it gets an error:
I get an error:
Line 15 Char 1 The "SendUsing" configuration value is invalid. Code 80040220 Source CDO.message.1
Is this because I'm doing it from my PC and not a server? How would I get it to mail from our mail server?
Thanks!
TT
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\FSO\ScriptLog.txt") Then
'Set objFolder = objFSO.GetFile("C:\FSO\ScriptLog.txt")
objFSO.DeleteFile("C:\FSO\ScriptLog.txt")
Else
'Wscript.Echo "File does not exist."
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "supportemail@address.org"
objEmail.To = "myemail@address.org"
objEmail.Subject = "File DOES NOT EXIST!"
objEmail.Textbody = "Your file does not exist, you have issues now ..."
objEmail.Send
End If
This scipt does delete the file if it's there, but if it's not there, it gets an error:
I get an error:
Line 15 Char 1 The "SendUsing" configuration value is invalid. Code 80040220 Source CDO.message.1
Is this because I'm doing it from my PC and not a server? How would I get it to mail from our mail server?
Thanks!
TT