Jump to content
Sign in to follow this  

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

Recommended Posts

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 ****
#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")
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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...