2 Replies Latest reply on Apr 2, 2008 8:54 PM by danpixley

    Batch File Distribution Returning Error

    Apprentice

       

      I have the following batch file set up as a distribution package that is reporting a failure for some reason:

       

       

       

       

       

      @ECHO ON

       

      REM This will force the local scheduler to use a Miniscan when the computer's IP address changes.

       

      localsch.exe /exe="%LDMS_LOCAL_DIR:~0,-5%\miniscan.exe" /ipaddr /freq=10 /taskid=778

       

      :end

       

       

       

       

       

      I've tested the distribution task as a push, but the scheduled task errors out with a result of, "The iterator's start position is invalid".  Oddly enough, the batch file is successfully applied to the target machine (the local scheduler updates the task perfectly).  Since the task reports a failure in the LANDesk scheduled task, it makes it hard to repeat the task on machines that truly failed.   Here is the view from the log:

       

       

       

       

       

      Wed, 02 Apr 2008 13:22:55 File (
      server\packages\update_inv_miniscan.bat) is cached locally

      Wed, 02 Apr 2008 13:22:57 Downloading file
      server\packages\update_inv_miniscan.bat (empfHFTL6eLlt/ZAxYYNbg==, 2)

      Wed, 02 Apr 2008 13:22:57 Downloading file 1 of 1 from '
      server\packages\update_inv_miniscan.bat'

      Wed, 02 Apr 2008 13:22:57 Batch file Client Thread

      Wed, 02 Apr 2008 13:22:57 PackagePath:     http://\\server\packages\update_inv_miniscan.bat

      Wed, 02 Apr 2008 13:22:57 Setting status for batch file to 778

       

      Wed, 02 Apr 2008 13:22:57 Batch file status of 778 obtained from shared memory

      Wed, 02 Apr 2008 13:22:57 treating status as win32 HRESULT, updated value 8007030a08x

      Wed, 02 Apr 2008 13:22:57 Bat file output :

       

      C:\Program Files\LANDesk\LDClient\sdmcache\packages>call "update_inv_miniscan.bat" 

       

       

       

      C:\Program Files\LANDesk\LDClient\sdmcache\packages>REM This will force the local scheduler to use a Miniscan when the computer's IP address changes.

       

       

       

      C:\Program Files\LANDesk\LDClient\sdmcache\packages>localsch.exe /exe="C:\Program Files\LANDesk\LDClient\miniscan.exe" /ipaddr /freq=10 /taskid=778

       

       

       

      C:\Program Files\LANDesk\LDClient\sdmcache\packages>"C:\Program Files\LANDesk\LDClient\sdclient.exe" /setbatchstatus=778

       

       

      Wed, 02 Apr 2008 13:22:57 Installation result 8007030A

      Wed, 02 Apr 2008 13:22:57 processing of package is complete, result -2147024118 (0x8007030a - code 778)

       

       

       

       

       

        • 1. Re: Batch File Distribution Returning Error
          ahe Expert

           

          Hello danpixley,

           

           

          here you can find a great documentation from Jared Barneck:  Understanding Batch file Distribution Packages

           

           

          If you want to get a "failed" in your Scheduled Task instead of "successful" you have to check the check the parameter %errorlevel%.

          If the errorlevel is ok you can set "0" as Exit code of the batch, otherwise use some value other...

           

           

          For example: you want to create a directory, if exist you will get a error message, otherwise it works: (s. examples in Jared's doc)

           

          set "LDDIR=%LDMS_LOCAL_DIR:~0,-5%"
          md %temp%\dummy
          set "ResultCode=%errorlevel%"
          if "%ResultCode%"=="0" (
          REM this line send a message and the result code to the Scheduled Task
          "%LDDIR%\sdclient.exe" /msg="Directory dummy is created, result code: %ResultCode%"
          ) else (
          REM this line send a message and the result code to the Scheduled Task
          "%LDDIR%\sdclient.exe" /msg="Directory dummy is NOT created, result code: %ResultCode%"
          )
          REM this line ends the batch and send a return code to the Scheduled Task
          EXIT /B %ResultCode%

           

           

           

           

          Regards

          Axel

           

           

          • 2. Re: Batch File Distribution Returning Error
            Apprentice

             

            i FOUND EXACTLY WHAT i WAS LOOKING FOR.  THANK YOU FOR THAT HELPFUL DOCUMENTATION.  hERE IS MY WORKING SCRIPT:

             

             

             

             

             

            @ECHO ON

             

            REM This will force the local scheduler to use a Miniscan when the computer's IP address changes.

             

            localsch.exe /exe="%LDMS_LOCAL_DIR:~0,-5%\miniscan.exe" /ipaddr /freq=10 /taskid=778

             

            if errorlevel==778 EXIT /B 0\