6 Replies Latest reply on Aug 13, 2010 2:20 PM by ldmsusr

    Created batch file to perform multi reboots

    Apprentice

      I have ctreated a batch file to preform two reboot.

       

      I schedule reboot batch file. file executes and device reboots but task is then put on pending. It will not run section part of the batch file. is there a better way to deliver multi reboot via landesk

       

      Thanks in advance

        • 1. Re: Created batch file to perform multi reboots
          Expert

          Is there something that runs between the reboots?

          • 2. Re: Created batch file to perform multi reboots
            Apprentice

            Hi There

             

            This is the script i'm testing

             

             

            if "%1" == "" goto section1
            if "%1" == "section2" goto section2
            if "%1" == "section3" goto alldone
            if "%1" == "alldone" goto alldone

             

            :section1
            REM ---------------------------------------------
            REM -- do work here that will require a reboot --
            REM ---------------------------------------------
            sdclient.exe /msg="The client has not yet rebooted."
            sdclient.exe /onreboot /bat /p=%0 /cmds=section2
            sdclient.exe /reboot
            goto getout

             

            :section2
            REM ---------------------------------------------
            REM -- do work here that will require a reboot --
            REM ---------------------------------------------
            sdclient.exe /msg="The client has rebooted once."
            sdclient.exe /onreboot /bat /p=%0 /cmds=section3
            sdclient.exe /reboot
            goto getout

             

            :section3
            REM ---------------------------------------------
            REM -- do work here that will require a reboot --
            REM ---------------------------------------------
            sdclient.exe /msg="The client has rebooted twice."
            sdclient.exe /onreboot /bat /p=%0 /cmds=alldone
            sdclient.exe /reboot
            goto getout

             


            :alldone
            REM -----------------------------------------
            REM -- Finish up the work after the reboot --
            REM -----------------------------------------
            set errorlevel=0
            sdclient.exe /msg="The client has reboot three times, we are now done."
            :getout

            • 3. Re: Created batch file to perform multi reboots
              Rookie

              I cant speak for LDMSUSR but I could also use a function like this and yes something would run between reboots.  For example, we have several machines that are grossly infected with malware and conficker. we run a cleaner on them that takes a long time and requires multiple reboots. A fire and forget task would be great.

              • 4. Re: Created batch file to perform multi reboots
                Expert

                You might want to look at using a provisioning template and perform the reboots within the template. Its about the best way I can think of to chain app / reboot / app / reboot.... Provisioning doesn't have to be about installing an OS. You can use the configuration section separately.

                • 5. Re: Created batch file to perform multi reboots
                  Rookie

                  AHHH!! I havent even thought about using provisioning. Great idea.

                  • 6. Re: Created batch file to perform multi reboots
                    Apprentice

                    Agree have used thi sin the past just wanted to see if this was possible. More work then needed.

                     

                    Thanks for your replies