I have a script i am running below and pass in a set of arguments for example the one below but the powershell script is not picking up the distribution list and the text file for the one that matches the input strings the best. In this example its is picking up the distribution list for PRD_TEST_*START rather than PRD_TEST_BOX_BOX_BOX_REL so i am unsure why it is not picking up the closest match. Any help much appreciated,
regards
Paul
Batch_Email.ps1 CAUAJM_I_40245 EVENT: CHANGE_STATUS STATUS: SUCCESS JOB: PRD_TEST_BOX_BOX_BOX_REL
# Assign variables for parameters passed by Event Management
$STATUS = $args[4]
$JOB = $args[6]
$MACHINE = $args[8]
$RETCODE = $args[10]
# Allocate temporary work files for mail text
$TEXTFILE = "C:\Temp\email5$JOB.txt.$PID"
# Create Distribution list and Assignee Group based on jobname
switch -Wildcard ($args -join '') {
"MUST_START_ALARM*PRD_TEST_START_BOX_BOX_BOX_*" {
$distrib = "TEST-Bair-TEST@BairAutosys.test.xmatters.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,baan_faults@test.com,pnixon@test.com"
}
"*PRD_TEST_START_BOX_BOX_BOX_REL*" {
$distrib = "TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,abullen1@test.com,ccampb21@test.com,mkeefe@test.com,yali2@test.com,zpatel2@test.com"
}
"*PRD_TEST_START_BOX_BOX_BOX_*" {
$distrib = "TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,abullen1@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com"
}
"*PRD_TEST_TEST3632V_LN_REINDEXING_*_1800_BOX_SAT*" {
$distrib = "TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,abullen1@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*MAXRUNALARM*PRD_TEST_STOP_BOX_BOX_BOX*" {
$distrib = "TEST-Bair-TEST@BairAutosys.test.xmatters.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_DOORS_START_BOX_BOX_BOX_PAT*" {
$distrib = "TESTcommandcentre@test.com,csccatia.support@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,adugdale@test.com"
$group = "csc.pre.as.baan"
}
"*FAILURE*PRD_TEST_*LN_WEEK_PHX_B24*" {
$distrib = "TEST-Bair-TEST@BairAutosys.test.xmatters.com,TESTcommandcentre@test.com,arjun.ganatra@test.com,colin.jack@test.com,baan_faults@test.com,mbusscc.airerp@test.com,IMSUKNTOPS_MAIL@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com,abullen1@test.com,pnixon@test.com,michael.robinson13@test.com,ian.scarborough@test.com,matthew.goldsmith@test.com,helen.brown2@test.com,colin.rooney@test.com,tom.mcnicholas@test.com,rachel.smart3@test.com,matthew.ainsworth@test.com,thomas.booth@test.com,andrew.parker9@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*SUCCESS*PRD_TEST_*LN_WEEK_PHX_B24*" {
$distrib = "TESTcommandcentre@test.com,arjun.ganatra@test.com,colin.jack@test.com,baan_faults@test.com,mbusscc.airerp@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,abullen1@test.com,michael.robinson13@test.com,ian.scarborough@test.com,matthew.goldsmith@test.com,helen.brown2@test.com,colin.rooney@test.com,tom.mcnicholas@test.com,rachel.smart3@test.com,matthew.ainsworth@test.com,thomas.booth@test.com,andrew.parker9@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B73*" {
$distrib = "ccampb21@test.com,systemsoperations.finance@test.com,mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B76*" {
$distrib = "ian.mellor3@test.com,daz.wren@test.com,matt.cooker@test.com,mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B78*" {
$distrib = "fsinvoicingservice@test.com,pnixon@test.com,baan_faults@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B81*" {
$distrib = "abullen1@test.com,ccampb21@test.com,mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B89*" {
$distrib = "abullen1@test.com,ccampb21@test.com,systemsoperations.finance@test.com,mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B91*" {
$distrib = "abullen1@test.com,ccampb21@test.com,systemsoperations.finance@test.com,mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_GLKA*B84*" {
$distrib = "simon.bridge@test.com,dan.mcnicholls@test.com,judith.mellor2@test.com,sue.leech@test.com,airuk2r@test.com,Systemsoperations.Finance@test.com,kenneth.swarbrick@test.com,pnixon@test.com,baan_faults@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_*BV_ARCHIVING*" {
$distrib = "mbusscc.airerp@test.com,michael.robinson13@test.com,matthew.goldsmith@test.com,rachel.smart3@test.com,matthew.ainsworth@test.com,thomas.booth@test.com,andrew.parker9@test.com,baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST*EAM*" {
$distrib = "mbusscc.airerp@test.com,baan_faults@test.com,pnixon@test.com,abullen1@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST*FW*" {
$distrib = "baan_faults@test.com,pnixon@test.com"
$group = "CSC.All.Eur.MCS.PCS"
}
"*PRD_TEST_NETBACKUP_TEST4078V_CHECK_SERVER_BACKUP_*" {
$distrib="baan_faults@test.com,pnixon@test.com"
$group="CSC.All.Eur.MCS.Storage"
}
"*PRD_TEST_NETBACKUP_CHECK_TEST4078V_TAPEBACKUP_*" {
$distrib="baan_faults@test.com,pnixon@test.com"
$group="CSC.All.Eur.MCS.Storage"
}
"*PRD_TEST_NETBACKUP_baesvlmds153v_CHECK_SERVER_BACKUP_*" {
$distrib="baan_faults@test.com,pnixon@test.com"
$group="CSC.All.Eur.MCS.Storage"
}
"*PRD_TEST_NETBACKUP_baesvlmds339v_CHECK_SERVER_BACKUP_*" {
$distrib="baan_faults@test.com,pnixon@test.com"
$group="CSC.All.Eur.MCS.Storage"
}
"*PRD_TEST_*NETBACKUP*" {
$distrib="baan_faults@test.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com"
$group="CSC.All.Eur.MCS.Storage"
}
"PRD_TEST_*STOP*" {
$distrib="baan_faults@test.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com"
$group="csc.pre.as.baan"
}
"*TEST_KABA_*STOP*" {
$distrib="TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,gblackhu@test.com,skamins2@test.com"
$group="csc.pre.as.baan"
}
"*TEST_KABA_*START*" {
$distrib="IMSUKNTOPS_MAIL@test.com,pnixon@test.com,gblackhu@test.com,skamins2@test.com"
$group="csc.pre.as.baan"
}
"*PRD_DOORS_*" {
$distrib="TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,csccatia.support@test.com"
$group="csc.pre.as.baan"
}
"*PRD_TEST_*START*" {
$distrib="baan_faults@test.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com"
$group="csc.pre.as.baan"
}
"*PRD_TEST_*LN*" {
$distrib="baan_faults@test.com,mbusscc.airerp@test.com,TESTcommandcentre@test.com,IMSUKNTOPS_MAIL@test.com,pnixon@test.com,michael.robinson13@test.com,ian.scarborough@test.com,matthew.goldsmith@test.com,helen.brown2@test.com,colin.rooney@test.com,tom.mcnicholas@test.com,rachel.smart3@test.com,matthew.ainsworth@test.com,thomas.booth@test.com,andrew.parker9@test.com,abullen1@test.com,ccampb21@test.com,zpatel2@test.com,mkeefe@test.com,yali2@test.com"
$group="csc.pre.as.baan"
}
}
# User SECTION
# ------------
# Header text lines
$LINE1 = "BAE TEST(DEV) Batch Alert on Autosys Workload Automation"
$LINE2 = "-----------------------------------------------------------"
$LINE3 = Get-Date
$LINE4 = ""
$LINE5 = ""
# Create email text based on the alert type
switch -Wildcard ($args -join '') {
"*MACH_OFFLINE*" {
$subject="TEST(PRD) Machine/Agent OFFLINE Alert : Machine $5 ** Please Investigate **"
$LINE6="Machine: $5"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="This Machine/Agent is OFFLINE and needs to be Investigated ASAP as it will impact the Scheduling"
$LINE11=""
$LINE12="Please Restart the Machine/Agent - Logon to the Server, go into Services and START CA Workload Automation Agent. If any further issues please contact Application Support On Call Support Team Member on xxxxx xxxxxx."
$LINE13=""
}
"*SUCCESS*PRD_TEST_*B73*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The log file generated for this run can be found on the server TEST3632v within the directory: "
$LINE13="d:/infor/bse/xch/412/hoursulg/log"
}
"*SUCCESS*PRD_TEST_*B81*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12=""
$LINE13=""
}
"*SUCCESS*PRD_TEST_STOP_BOX_BOX_BOX_PAT*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Stop schedule is now complete and all the TEST Applications should now be unavailable to users so monthly patching can begin."
$LINE13=""
}
"*SUCCESS*TEST_KABA_STOP_BOX_BOX_BOX_PAT*" {
$subject="KABA(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Stop schedule is now complete and all the KABA Applications should now be unavailable to users so monthly patching can begin."
$LINE13=""
}
"*SUCCESS*PRD_TEST_START_BOX_BOX_BOX_REL*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Start schedule is now complete and the backups taken, all the TEST Applications should now be available. The system is NOW ready for the release window to begin."
$LINE13=""
}
"*SUCCESS*PRD_TEST_START_BOX_BOX_BOX_*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Start schedule is now complete and all the TEST Applications should now be available to users except during scheduled maintenance."
$LINE13=""
}
"*SUCCESS*PRD_TEST_TEST3632V_LN_REINDEXING_*_1800_BOX_SAT*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Reindexing schedule is now complete and all the TEST LN Applications should now be available to users."
$LINE13=""
}
"*SUCCESS*TEST_KABA_START_BOX_BOX_BOX*" {
$subject="KABA(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Start schedule is now complete after patching and all the KABA Applications should now be available to users except during scheduled maintenance."
$LINE13=""
}
"*SUCCESS*PRD_DOORS_START_BOX_BOX_BOX*" {
$subject="DOORS(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12="The Application Start schedule is now complete after patching and all the DOORS Applications should now be available to users except during scheduled maintenance."
$LINE13=""
}
"*SUCCESS*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has successfully completed (Information ONLY)"
$LINE11=""
$LINE12=""
$LINE13=""
}
"*RUNNING*STOP*BOX*PAT*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job is in a status of RUNNING"
$LINE11="OPS Please Start to Monitor the STOP Scheduling to ensure the BOX - PRD_TEST_STOP_BOX_BOX_BOX_PAT and"
$LINE12="all its SUB BOX's complete as the LN Servers/System are shutting DOWN for PATCHING activities, once complete you will receive notification to begin your activities."
$LINE13=""
}
"*RUNNING*KABA*STOP*BOX*PAT*" {
$subject="KABA(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job is in a status of RUNNING"
$LINE11="OPS Please Start to Monitor the STOP Scheduling to ensure the BOX - TEST_KABA_STOP_BOX_BOX_BOX_PAT and"
$LINE12="all its SUB BOX's complete as the KABA Servers/System are shutting DOWN for PATCHING activities, once complete you will receive notification to begin your activities."
$LINE13=""
}
"*RUNNING*STOP*BOX*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job is in a status of RUNNING"
$LINE11="OPS Please Start to Monitor the STOP/NETBACKUP/START Scheduling to ensure the BOX - PRD_TEST_STOP_NETBACKUP_START_BOX_BOX_BOX_day and"
$LINE12="all its SUB BOX's complete as the LN Servers/System is DOWN until this process fully completes SUCCESSFULLY, once complete the LN Batch will START"
$LINE13=""
}
"*RUNNING*PRD_TEST_TEST3632V_LN_REINDEXING_*_1800_BOX_SAT*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job is in a status of RUNNING"
$LINE11="The Reindexing schedule has started and the TEST LN Application will be unavailable to end users for upto 6 hours. Please ignore the BaanLogicService alerts in Nagios for TEST3630v/TEST3631v."
$LINE12="Once the Reindexing schedule is complete you will receive an email detailing its success."
$LINE13=""
}
"*RUNNING*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job is in a status of RUNNING"
$LINE11=""
$LINE12=""
$LINE13=""
}
"*TERMINATED*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Machine: ${MACHINE}"
$LINE9=""
$LINE10="Job has been manually terminated"
$LINE11=""
$LINE12=""
$LINE13=""
}
"*FAILURE*PRD_TEST_*B76*EXITCODE:*120*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed successfully, however some rows were not loaded into LN due to errors, refer to log file for details."
$LINE12=""
$LINE13="The logfile can be found on TEST3619V in Test\Bulk_Uploads\UPD_T02 it will be the latest log.EXE.*.1 file."
}
"*PRD_TEST_*B89*SUC-T01*EXITCODE:*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed, if it has failed some rows were not loaded into LN due to errors, refer to log file for details."
$LINE12=""
$LINE13="The logfile can be found on TEST3619V in Test\SuccessFactors\T01\ErrorLog it will be the latest log.* file."
}
"*PRD_TEST_*B84*EXITCODE:*120*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed successfully, however some rows were not loaded into LN due to errors, refer to log file for details."
$LINE12=""
$LINE13="The logfile can be found on TEST3619V in Test\Bulk_Uploads\T04 it will be the latest log.EXE.*.1 file."
}
"*FAILURE*PRD_TEST_*B78*EXITCODE:*120*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed successfully, however some rows were not loaded into LN due to errors, refer to log file for details."
$LINE12=""
$LINE13="The logfile can be found on TEST3632V in D:\Infor\bse\xch\412\UPD_T03\log it will be the latest log.EXE.*.1 file."
}
"*FAILURE*PRD_TEST_*EXITCODE:5*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has failed due to access denied, the job will automatically rerun in 30 seconds if no further emails are received it has been successful."
$LINE12=""
$LINE13=""
}
"*FAILURE*PRD_TEST_*BVA-BDS-UMV*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed with errors."
$LINE12=""
$LINE13="BV Archiving execution of phx_update_max_variation on BV_BDS returned an error. Review log files in D:\BV\Archiving for further information."
}
"*FAILURE*PRD_TEST_*BVA-CDS-UMV*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed with errors."
$LINE12=""
$LINE13="BV Archiving execution of phx_update_max_variation on BV_CDS returned an error. Review log files in D:\BV\Archiving for further information."
}
"*FAILURE*PRD_TEST_*BVA-BDS-DSV*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed with errors."
$LINE12=""
$LINE13="BV Archiving execution of phx_delete_superseded_variation on BV_BDS returned an error. Review log files in D:\BV\Archiving for further information."
}
"*FAILURE*PRD_TEST_*BVA-CDS-DSV*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Batch job has completed with errors."
$LINE12=""
$LINE13="BV Archiving execution of phx_delete_superseded_variation on BV_CDS returned an error. Review log files in D:\BV\Archiving for further information."
}
"*FAILURE*PRD_TEST_TEST3632V_*PHX_B37_*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Job has been manually terminated"
$LINE12="Please invoke callout to Apps Support as the LN Master server is unavailable due to shared memory issues"
$LINE13=""
}
"*FAILURE*PRD_TEST_TEST363*V_*PHX_B37*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Job has been manually terminated"
$LINE12="Please invoke callout to Apps Support as the LN Apps server on this node is unavailable due to shared memory issues"
$LINE13=""
}
"*FAILURE*PRD_TEST_TEST3632V_LN_CHECK*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="One of the batch jobs is in a RUNNING state within LN."
$LINE12="Please invoke callout to Application Support Team(Team Member on xxxxx xxxxxx) and raise a Sev 3 SNOW incident"
$LINE13=""
}
"*FAILURE*PRD_TEST_TEST3632V*PHX_B24C*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="The above batch job has failed within LN, please raise a Sev 2 SNOW incident and assign to Application Support - and inform MIM."
$LINE12="An automated call from Xmatters will be placed to Application Support Team(Team Member on xxxxx xxxxxx) if no response within 30 minutes please contact the support number."
$LINE13=""
}
"*FAILURE*PRD_TEST_*EAM*" {
$subject="EAM-ETL(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Please note the above batch job has failed within EAM_ETL please investigate."
$LINE12=""
$LINE13=""
}
"*FAILURE*PRD_TEST_*_START_*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="One of the Application start jobs has failed, it will attempt 5 reruns a minute apart. If you do not receive another email alert within a minute the rerun was successful"
$LINE12="and you can ignore this message and you will get an email with the PRD_TEST_START_BOX_BOX_BOX completion which indicates the success of the backup sequence. If the job is still failing after 5 reruns please callout Application Support and raise a sev 2 SNOW incident."
$LINE13=""
}
"*FAILURE*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11=""
$LINE12=""
$LINE13=""
}
"*MAXRUNALARM*PRD_TEST_TEST363*V_*PHX_B37*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7="Status: ${STATUS}"
$LINE8="Retcode: ${RETCODE}"
$LINE9="Machine: ${MACHINE}"
$LINE10=""
$LINE11="Job has exceeded maximum run time"
$LINE12="Please invoke callout to Apps Support as the LN Apps server on this node is unavailable due to shared memory issues"
$LINE13=""
}
"*MAXRUNALARM*PRD_TEST_STOP_BOX_BOX_BOX*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="The STOP Application schedule has exceeded its maximum run time"
$LINE11="Please raise a Sev 3 SNOW incident and assign to Application Support - An automated callout via Xmatters to Application Support Team(Team Member on xxxxx xxxxxx) will be made if no response within 30 minutes please contact the support number provided."
$LINE12=""
$LINE13=""
}
"*MUST_START*PRD_TEST_START_BOX_BOX_BOX*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="The START Application schedule has not begun by 21:25 and need investigation."
$LINE11="Please raise a Sev 3 SNOW incident and assign to Application Support . An automated callout via Xmatters to Application Support Team(Team Member on xxxxx xxxxxx) will be made if no response within 30 minutes please contact the support number provided."
$LINE12=""
$LINE13=""
}
"*MAXRUNALARM*PRD_TEST_START_BOX_BOX_BOX*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="The START Application schedule has not completed on time."
$LINE11="Please check Autosys schedule to investigate issue and if unable to determine please invoke callout to Application Support Team(Team Member on xxxxx xxxxxx)"
$LINE12=""
$LINE13=""
}
"*MAXRUNALARM*PRD_TEST*EAM*" {
$subject="EAM - ETL(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="The EAM ETL job has not completed on time and overun its maximum runtime."
$LINE11="The next job will not start until this job has completed."
$LINE12=""
$LINE13=""
}
"*MAXRUNALARM*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="Job has exceeded its maximum run time"
$LINE11=""
$LINE12=""
$LINE13=""
}
"*MINRUNALARM*" {
$subject="TEST(PRD) Batch Alert : Job ${JOB} - status ${STATUS}"
$LINE6="Job: ${JOB}"
$LINE7=""
$LINE8=""
$LINE9=""
$LINE10="Job has ended before its minimum run time"
$LINE11=""
$LINE12=""
$LINE13=""
}
}
# Create the text file for the email
$EmailContent = @"
-----------------------------------------------------
$LINE1
$LINE2
$LINE3
$LINE4
$LINE5
$LINE6
$LINE7
$LINE8
$LINE9
$LINE10
$LINE11
$LINE12
$LINE13
Application Support Autosys Administration
"@
Set-Content -Path $TEXTFILE -Value $EmailContent
# Send the email
if ($distrib -ne "") {
Send-MailMessage -To $distrib.Split(",") -From AutosysAdmin@test.com -Subject $subject -Body (Get-Content -Path $TEXTFILE -Raw) -SmtpServer apprelay.testlnk.net
}
exit`Preformatted text`
type or paste code here
````Preformatted text`