Link to home
Start Free TrialLog in
Avatar of GPSPOW
GPSPOWFlag for United States of America

asked on

Creating an event trigger for a scheduled task on Windows Server 2008 R2

I have a scheduled task that currently runs every night at 3 AM.  I want to add an event trigger that will allow the task to run if a condition is met.

The task copies files with monetary transactions to  specific folders.  I will have a text file that designates whether or not the amounts are in balance.  If the text file value is set to "Y" then the files are to be copied otherwise an email will be sent notifying the recipients of the out of balance condition.

How can I do this?

Thanks

Glen
Avatar of Lionel MM
Lionel MM
Flag of United States of America image

so you will have two amounts in this text file, somewhere, and if they are the same you want X and if they are not the same you want Y? Can you post the text file so we can see what we need to search for?
Avatar of GPSPOW

ASKER

Attached is an example of the "csv" file that will be generated.  The column "InBal" has a "N" value.

If this value is "Y" then I want the task to run.  If the value is "N" then I need to send an email reporting the out of balance condition.  I will use the fields within this file:

OPSATB, SPATB etc. as data within the email.

Let me know if you need anything else.

Thanks

Glen
CroweMsg.csv
ASKER CERTIFIED SOLUTION
Avatar of Lionel MM
Lionel MM
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GPSPOW

ASKER

Here is the batch file that runs if the "InBal"="Y"

net use D:\DTS

copy  D:\DTS\DailyATB\Daily_ATB_Test.txt  "\\pmcfs\groups\Accounting\CHI\DailyATB\rca_p1_mt_daily_accts_"%date:~10,4%%date:~4,2%%date:~7,2%".csv"
copy  D:\DTS\DailyBD\DAILY_ATB_BD_XFR.txt  "\\pmcfs\groups\Accounting\CHI\BadDebtData\rca_p1_mt_bd_transfers_"%date:~10,4%%date:~4,2%%date:~7,2%".csv"

copy  D:\DTS\DailyTXN\DAILY_ATB_TXN_DETAIL.txt  "\\pmcfs\groups\Accounting\CHI\DailyTxnData\rca_p1_mt_daily_txn_"%date:~10,4%%date:~4,2%%date:~7,2%".csv"

copy  D:\DTS\DailyNPA\DAILY_ATB_NPA.txt  "\\pmcfs\groups\Accounting\CHI\DailyNPA\rca_p1_mt_daily_npa_"%date:~10,4%%date:~4,2%%date:~7,2%".csv"

net use D:\DTS /DELETE


If "InBal" ="N" then:

Recipient:  gpspow55@gmail.com
Sender:   gpowers@stlukeshealth.org
Subject:  Daily ATB Files Not In Balance
Message:  "Text lines"  and then list:

"OPS ATB:"    OPSATB value
"SP ATB:"       SPATB value
... all other values.

Thanks

Glen
And this work as is--you have tested this batch file (because there seems to be nothing to send the email to me)?
Avatar of GPSPOW

ASKER

I think I get the gist of what I need to do with the existing batch file I have been using to create files unconditionally.  I will put it in the :yes section and test to see if it will run with the conditions.

Thanks

Glen
OK but let me know if you can't get it to work.