D
Dana803
Guest
I have been tasked with automating creating reports and emailing them from a Windows Server 2008 R2 VM.
I have successfully created a command that uses the ruby executable to pull a report and save it as a pdf file on a local folder on the server. If I delete the file and run it again using a Scheduled Task, it works again. So, all good there.
My next step is to email that file and automate that, too. So, I would essentially have 2 scheduled tasks that would be run monthly. After many tribulations, I have been able to successfully use a sendEmail command at the cmd prompt to email that file to me as a test. Great! I try to run that same command using the Task Scheduler, and although the Task Scheduler reports all steps were successful and complete, I receive no email. Ugh!
So... task scheduler can allow a file to be created and placed in a folder but can't send an email? Is there something I don't know about getting Task Scheduler to run a command even thought it works fine when manually executing the command from a cmd prompt?
This is Windows Server 2008 R2 on a VM so I remote to it using a domain account. We do not have Exchange. We use an smtp server through Office 365. This machine is strictly used to run the Spiceworks program, which is doing great and even turns incoming emails into tickets and emails ticket notifications without a problem. The sendemail.exe and the report to be attached are in one folder local to the server.
What I've tried thus far:
First tried using Blat for the email sending, but couldn't even get that to work from a cmd prompt.
Made sure the sendemail command worked with all the desired switches from a cmd line. I receive the email with attachment within a second or two of executing it.
I've tried running the scheduled task using a local account as well as my domain account.
I've checked and unchecked the use with highest priviledges option.
I've chosen the "config for Windows 2008 R2" as well as "config for Windows 2008".
I've checked and unchecked the "store password" option.
I've placed the command in a bat file, confirmed that the bat file works when manually executed, then tried to execute the same bat file using the scheduler, with no luck. When creating the bat file, I simply put the command in a text file and renamed it with a bat extension. I did not add any additional lines of code in it.
The local security policy allows the user running the task to Log On as a Batch Job.
Everything I've tried shows as successful in the Task Scheduler, but I never get the email.
I can't seem to find any helpful or relevant info in the event viewer or in the history details of the task.
Are there certain reasons why task scheduler is unable to complete this sendemail task even though it works when executed manually? Are there any error logs that exist or can be created to help out a little more? Any help or direction is greatly appreciated.
Dana Schwehr MCP, A+
Continue reading...
I have successfully created a command that uses the ruby executable to pull a report and save it as a pdf file on a local folder on the server. If I delete the file and run it again using a Scheduled Task, it works again. So, all good there.
My next step is to email that file and automate that, too. So, I would essentially have 2 scheduled tasks that would be run monthly. After many tribulations, I have been able to successfully use a sendEmail command at the cmd prompt to email that file to me as a test. Great! I try to run that same command using the Task Scheduler, and although the Task Scheduler reports all steps were successful and complete, I receive no email. Ugh!
So... task scheduler can allow a file to be created and placed in a folder but can't send an email? Is there something I don't know about getting Task Scheduler to run a command even thought it works fine when manually executing the command from a cmd prompt?
This is Windows Server 2008 R2 on a VM so I remote to it using a domain account. We do not have Exchange. We use an smtp server through Office 365. This machine is strictly used to run the Spiceworks program, which is doing great and even turns incoming emails into tickets and emails ticket notifications without a problem. The sendemail.exe and the report to be attached are in one folder local to the server.
What I've tried thus far:
First tried using Blat for the email sending, but couldn't even get that to work from a cmd prompt.
Made sure the sendemail command worked with all the desired switches from a cmd line. I receive the email with attachment within a second or two of executing it.
I've tried running the scheduled task using a local account as well as my domain account.
I've checked and unchecked the use with highest priviledges option.
I've chosen the "config for Windows 2008 R2" as well as "config for Windows 2008".
I've checked and unchecked the "store password" option.
I've placed the command in a bat file, confirmed that the bat file works when manually executed, then tried to execute the same bat file using the scheduler, with no luck. When creating the bat file, I simply put the command in a text file and renamed it with a bat extension. I did not add any additional lines of code in it.
The local security policy allows the user running the task to Log On as a Batch Job.
Everything I've tried shows as successful in the Task Scheduler, but I never get the email.
I can't seem to find any helpful or relevant info in the event viewer or in the history details of the task.
Are there certain reasons why task scheduler is unable to complete this sendemail task even though it works when executed manually? Are there any error logs that exist or can be created to help out a little more? Any help or direction is greatly appreciated.
Dana Schwehr MCP, A+
Continue reading...