I have worked on this for about 8 hours and have tried a ton of advice from lots of forums, but still cannot get this working.
I have a script that creates and sends an email when it is run. When run from the command prompt everything works beautifully. When I run it from the task scheduler the log shows it ran successfully, but I receive no email. (This code sits on a Windows 7 server and the Administration account is always logged in.)
Here is what I have tried:
-- Task has been created and is run by Administrator account. -- Run if logged in or not, Run with the highest privileges
-- Program Script = C:\Windows\system32\cscript.exe -- Arguments = "C:\CSO.vbs" -- start in = C:\
-- I looked at the task scheduler properties (local computer) and the Log On is set to Local System Account, but Allow services to Interact with desktop is NOT checked. This is greyed out and I do not know how to check it.
-- Under Active Tasks in the task scheduler is says the task location = \
-- I went to UAC and do not see anything wrong here, but may not know what I need to look at.
Here is the script that is called:
'Creates a new e-mail item and modifies its properties'Dim olApp
Set olApp = CreateObject("Outlook.Application")
Dim objMail
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.Subject = "Fuel Inventory 178"
.Body = "EJ Pope Inventory file for HM163 and HM144"
.Recipients.Add("email address")
.Attachments.Add("C:\CSO Outgoing\Fuel Inventory 178.txt")
.Recipients.ResolveAll
.display
.Send
End With
Do I need to add something to my script? Do I have a permission problem? Does anyone have any insights?
Thanks,
Cindy