Sorry about that, I didn't think the code would be helpful since it works fine when manually clicked. But here it is, please pardon the sloppiness
#include <Date.au3>
#include <INet.au3>
;Make Todays Date
$tTime = _Date_Time_GetSystemTime()
$aTime = _Date_Time_SystemTimeToArray($tTime)
Global $Month = $aTime[0]
Global $Day = $aTime[1]
Global $Year = $aTime[2]
Global $FolderDate = $Month&"-"&$Day&"-"&$Year
Global $s_SmtpServer = "mail.FooBar.com"
Global $s_FromName = "Backup Script"
Global $s_FromAddress = "info@FooBar.com"
Global $s_ToAddress = "brian@FooBar.com"
Global $Fail = ""
Global $Folder = ""
Global $FreeSpace = Round ((DriveSpaceFree( $Folder )/1000),2)
Global $Databases = "C:\Data 8-2012\"
Global $Rolodex = "\\ALYSON\Database BUs\"
ToolTip("Preparing for Database Back up",300,1,'Daily Back up',1)
Sleep(1000)
ALYSON()
Func ALYSON()
$Folder = "\\ALYSON\Database BUs\"
$FreeSpace = Round ((DriveSpaceFree( $Folder )/1000),2)&" GB"
ToolTip("Preparing for Database Back up"&@CR&"Backing up to ALYSON"&@CR&"Free Space: "&$FreeSpace,300,1,'Daily Back up',1)
Sleep(1000)
;MsgBox(4096, "Free space on :"&$Folder, $FreeSpace & " GB",10)
$Copy = FileCopy($Databases&"*.*",$Folder&$FolderDate&"\*.*",8)
If $Copy = 1 Then
;MsgBox(0,"Success","Copied "&$Copy,10)
ToolTip("Preparing for Database Back up"&@CR&"Backing up to ALYSON"&@CR&"Free Space: "&$FreeSpace&@CR&"Back up Successful",300,1,'Daily Back up',1)
MailSuc()
ToolTip("Preparing for Database Back up"&@CR&"Backing up to ALYSON"&@CR&"Free Space: "&$FreeSpace&@CR&"Back up Successful"&@CR&"Mail Sent to "&$s_ToAddress,300,1,'Daily Back up',1)
Sleep(1000)
Else
;MsgBox(0,"Fail","Fail "&$Copy,10)
ToolTip("Preparing for Database Back up"&@CR&"Backing up to ALYSON"&@CR&"Free Space: "&$FreeSpace&@CR&"Back up Failed",300,1,'Daily Back up',2)
MailFail()
ToolTip("Preparing for Database Back up"&@CR&"Backing up to ALYSON"&@CR&"Free Space: "&$FreeSpace&@CR&"Back up Failed"&@CR&"Mail Sent to "&$s_ToAddress,300,1,'Daily Back up',2)
Sleep(1000)
EndIf
EndFunc
Func MailSuc()
$s_Subject = "Back Up Summary"
Dim $as_Body[3]
$err = @error
$as_Body[0] = "Copy to "&$Folder&$FolderDate
$as_Body[1] = "Driver Free Space "&$FreeSpace
$as_Body[2] = "Back Up was Good!"
$s_helo = "info@FooBar.com"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
$err = @error
EndFunc
Func MailFail()
$s_Subject = "Failed Back up"
Dim $as_Body[2]
$err = @error
$as_Body[0] = "Failed Copy to "&$Folder&$FolderDate
$as_Body[1] = "Driver Free Space "&$FreeSpace&" "&$err
$s_helo = "info@FooBar.com"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
EndFunc
I am running it with Admin rights from an Admin login and it is saved in Task Scheduler with the Admin password. Its just the mail portion that wont work from the Task Scheduler side. Same Script fired manually will function normally.
Thanks