Sign in to follow this  
Followers 0
dar100111

Running Autoit.exe from SQL Server Agent job task with CmdExec

1 post in this topic

Has Anyone ever tried to launch an exe from SQL Server Agent out of curiosity?  For some reason I'm having issues with Task Schedule for an autoit exe script that sends an email.  Funny thing is I have others that work just fine that are the same code almost.  I have those compiled and they work from Task Scheduler with no problems.  If I manually click on the file and run the exe it works just fine.  Anyone have any ideas that I could try.  Thanks!  Just trying to find a feasible way to schedule these every day and keep a record.  With the SQL server I can see that as well.  Wasn't sure if anything would prevent as I've never tried.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=..\DailyInvoicingReportsEmail_TUL32.exe
#AutoIt3Wrapper_Outfile_x64=..\DailyInvoicingReportsEmail_TUL64.exe
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <file.au3>
#include <Date.au3>
#include <Inet.au3>


$objMessage = ObjCreate ("CDO.Message")
With $objMessage
    .Subject = "Invoicing Reports"
    .Sender = "EXPD-TUL@blah.com"
    .From = "EXPD-TUL"
    .To = "daniel.rowe@blah.com"
    .TextBody = ""
    .AddAttachment ("F:\FTP\INB\DailyEmail\TUL\addlcharges.xls")
    .AddAttachment ("F:\FTP\INB\DailyEmail\TUL\consols.xls")
    .AddAttachment ("F:\FTP\INB\DailyEmail\TUL\neverbilled.xls")
    .AddAttachment ("F:\FTP\INB\DailyEmail\TUL\OCLnoOLA.xls")
EndWith
With $objMessage.Configuration.Fields
    .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "blah" ; <== SMTP SERVER
    .Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "" ; <== SMTP USERNAME
    .Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "" ; <== SMTP PASSWORD
    .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 28
    .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    .Update
EndWith
$objMessage.Send

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0