0

Created a task o windows 2012 Server, to run a *.bat file. Set up to run at startup and repeat task every 15 minutes.

@ECHO OFF


REM ------------------------------------------------------------------------------------------------------------------------

REM                             ENVIOS

REM ------------------------------------------------------------------------------------------------------------------------


IF EXIST C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Sonae\INVOICFF\*.* C:\Indra\AZConnect\5600000000427INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\ECI\INVOICFF\*.* C:\Indra\AZConnect\8422416999990INT\INVOICFF\)
IF EXIST C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* (MOVE C:\Indra\AZConnect\Export\Auchan\INVOICFF\*.* C:\Indra\AZConnect\5600000004289INT\INVOICFF\)


REM ------------------------------------------------------------------------------------------------------------------------

REM                             RECEÇÃO

REM ------------------------------------------------------------------------------------------------------------------------


IF EXIST C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000004289INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\5600000000427INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)
IF EXIST C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* (MOVE C:\Indra\AZConnect\8422416999990INT\ORDERSFF\*.* C:\Indra\AZConnect\Import\ORDERSFF\)


REM ------------------------------------------------------------------------------------------------------------------------
REM                     VALIDAÇÃO AZCONNECT EM MEMÓRIA
REM ------------------------------------------------------------------------------------------------------------------------

TASKKILL /F /IM AZCONNECT.EXE

REM ------------------------------------------------------------------------------------------------------------------------
REM                         RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)

REM ------------------------------------------------------------------------------------------------------------------------
REM                          COMUNICAÇÕES EDI
REM ------------------------------------------------------------------------------------------------------------------------

REM RASDIAL INDRA <user> <pass>

START /W C:\Indra\AZCONNECT\AZCONNECT.EXE /ER

REM RASDIAL INDRA /disconnect


REM ------------------------------------------------------------------------------------------------------------------------
REM                         RELATÓRIOS
REM ------------------------------------------------------------------------------------------------------------------------

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (Type C:\Indra\AZCONNECT\PBLIST.TXT >> C:\Indra\AZCONNECT\Reports\PBLIST.txt)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (Type C:\Indra\AZCONNECT\MBLIST.TXT >> C:\Indra\AZCONNECT\Reports\MBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\ICONTROL*.TXT (MOVE C:\Indra\AZCONNECT\ICONTROL*.TXT C:\Indra\AZCONNECT\Reports\)

IF EXIST C:\Indra\AZCONNECT\PBLIST.TXT (del C:\Indra\AZCONNECT\PBLIST.TXT)
IF EXIST C:\Indra\AZCONNECT\MBLIST.TXT (del C:\Indra\AZCONNECT\MBLIST.TXT)

it worked for a couple of weeks, than for no reason at all (or one i can find) it stopped working. any thoughts on why?

the OS is: windows 2012 server r2 foundation

1

Task is not running or script is not running? If the task is not running then script you have posted is of little importance. If the task is not running then I would start by looking at Operational Event LOG for Task Scheduler:

Event Viewer \ Applications and Services Logs \ Microsoft \ Windows \ TaskScheduler \ Operational

If there are no logs there, right click on the "Operational" and select "Enable Log". Restart and read what is going on.

  • let's see. if i run the script manually it runs with no problem whatsoever. other tasks i have created, such as backups, also run without any problems. that's why i'm not getting what's going on with this one. gonna check the log to rey to get some more info – questionador 2 days ago
  • the message i get on event viewer is the following: Task Scheduler launched "{614ea871-57ca-4c72-abff-73ac084aa577}" instance of task "\CHECK EDI" due to system startup. i don't see an error here, but it does not run, any thoughts? – questionador 2 days ago
  • Do you see EventID 200 (Action started) for that same task. You should see for the same task more EventID's. First 118 (task triggered by computer startup), then 100 (Task started) then 200 (Action started) then 129 (Process created) then 201 (Action completed) and finally 102 (Task completed). Are there any EventID's associated with this task immediately after 118 or 100 that is not 200? – toofat yesterday
  • Eg. if there is EventID telling you this Task is being registered, that could mean you are creating the task through GPO preferences in replace/update mode with delay option configured (which I did) and that the task is being rewritten before it has time to execute the action. So, do you see EventID's 200 and 201 for that task. If yes, then I would look closely into that script. Some actions need Admin rights. Under what account is script executing ("NT AUTHORITY\SYSTEM" with "Run with highest privileges" option selected or ???). So on and so forth ... – toofat yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.