1 2 Previous Next 20 Replies Latest reply on Sep 30, 2009 11:30 AM by brandonhyde

    force computer to reboot and automatically start scheduled provisioning template

    Rookie

      Question for all of you provisioning pro's out there:

       

      Is is possible to get a machine to reboot and automatically start a scheduled OS provisioning template?  For instance, if you start an OSD task it will automatically reboot the machine and start reimaging the machine... Is this possible with provisioning?

       

      Thanks for any and all reply's

        • 1. Re: force computer to reboot and automatically start scheduled provisioning template
          Apprentice

          This is only possible if your systems are set to PXE boot before booting to the hard disk in the BIOS.  IF this is the case in your environment, you can create a reboot action in the system migration section of your provisioning template.  To ensure that your provisioning task still runs if you want to execute it from the Windows PE menu tell the reboot task not to cause the script to terminate.

          • 2. Re: force computer to reboot and automatically start scheduled provisioning template
            Rookie

            I knew that was a possibility, but I wanted to tap into some brain power to see if there is a way to do it just like scheduling an OS deployment task to an existing client.  (You can schedule the OS deployment task on a machine that already exists in the LANDesk database and it will automatically reboot the machine and start the OS deployment task without having PXE set as the primary boot option.)  Thanks for the response!!

            • 3. Re: force computer to reboot and automatically start scheduled provisioning template
              Joshni SupportEmployee

              If you had a reboot listed as the 1st action in the system migration section then it would cause the pc to reboot into WINPE.  This would only work if your client was configured to PXE boot as the 1st boot option.

               

              Josh

              • 4. Re: force computer to reboot and automatically start scheduled provisioning template
                Rookie

                Josh,

                 

                Yes, I know these things...  I think that was the exact same thing that David said.  I want to know if you can do it similarly to OSD. (ie. OSD will reboot a machine and automatically start the image when scheduled on a machine that already exists in the LANDesk database, even though PXE boot is not the first boot option in the BIOS.)

                • 5. Re: force computer to reboot and automatically start scheduled provisioning template
                  Apprentice

                  The reason LANDesk allows you to boot to Windows PE (or DOS) via OSD Job is because it virtual boots to a PXE image.  Essentially, it copies down the windows PE img file to the local drive, defrags the image to ensure its on contiguous sectors of the hard disk and sets the master boot record to boot to the sector where the image starts.  Technically, you can do this with provisioning (i.e. set the system to boot to PXE) by emulating what is done in the script, however there is a difference between booting to the WinPE for OSD and WinPE provisioning.  If you can set the startnet.cmd in the Windows PE image to run through the provisioning section of the startup sequence it is possible.  I've not really looked at it but I imagine it can be done.

                   

                  Here are the first lines of an OSD script.  All that is happening here is that sdclient is being used to copy files to the landesk client directory. You can use copy file (or download file) actions in a provisioning template to emulate the copy commands here:

                   

                  REMEXEC0=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/bootfile.exe"
                  REMEXEC1=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/tlibr16.dll"
                  REMEXEC2=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/tlibr32.dll"
                  REMEXEC3=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/lddefrag.exe"
                  REMEXEC4=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/cicfgmgr.vxd"
                  REMEXEC5=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/cindis.vxd"
                  REMEXEC6=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/copyfile.exe"
                  REMEXEC7=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/winbom.ini"
                  REMEXEC8=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/ldvpe0.img"
                  REMEXEC9=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /dest="C:\ldvpe1.img" /p="http://%CUSTJOBHOSTIP%/landesk/vboot/ldvpe1.img"
                  REMEXEC10=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /p="http://%CUSTJOBHOSTIP%/landesk/vboot/tokreplw.exe"
                  REMEXEC11=<qt/>%LDMS_CLIENT_DIR%\sdclient.exe<qt/> /f /o /dest="%LDMS_CLIENT_DIR%\diskinfo.exe" /p="http://%CUSTJOBHOSTIP%/landesk/files/diskinfo.exe"

                   

                  the rest of these commands you can emulate by using the execute file action.  if you want to keep the commands pure, create a database replacement template variable for the landesk client directory and replace the %LDMS_CLIENT_DIR% with the variable created.


                  REMEXEC12=<qt/>%LDMS_CLIENT_DIR%\diskinfo.exe<qt/> update_winnt_sif <qt/>%LDMS_CLIENT_DIR%\winnt.sif.new<qt/>
                  REMEXEC13=<qt/>%LDMS_CLIENT_DIR%\copyfile.exe<qt/> <qt/>%LDMS_CLIENT_DIR%\ldvpe0.img<qt/> <qt/>%LDMS_CLIENT_DIR%\winnt.sif.new<qt/> \winnt.sif
                  REMEXEC14=<qt/>%LDMS_CLIENT_DIR%\lddefrag.exe<qt/> <qt/>%LDMS_CLIENT_DIR%\ldvpe0.img<qt/>, STATUS
                  REMEXEC15=<qt/>%LDMS_CLIENT_DIR%\bootfile.exe<qt/> %LDMS_CLIENT_DIR%\ldvpe0.img /keep /bootunsafe, ASYNC

                   

                   

                  As far as how to make the startnet.cmd know that you're running PROVISIONING and not OSD, I've not gotten that far in my mind.  Let me know how you go with this and I may have some more thoughts on it later.

                  1 of 1 people found this helpful
                  • 6. Re: force computer to reboot and automatically start scheduled provisioning template
                    Joshni SupportEmployee

                    We do not have any way to do this out of the box.  You would have to script something to do it.  David's post looks like he is in the right track.

                     

                    Josh

                    • 7. Re: force computer to reboot and automatically start scheduled provisioning template
                      Rookie

                      David,

                       

                      Thanks for your post.  It makes sense that you should be able to do it... Figuring it out is the hard part.  I will have to do some testing on it.  I was looking to see if anyone else has attempted this, and hopefully save me some work.  Thanks for everybody's responses!  If anyone else has any thoughts please post them.

                      • 8. Re: force computer to reboot and automatically start scheduled provisioning template
                        Apprentice

                        After having a bit of a look at the startnet.cmd, I've found the following:

                         

                        @echo off
                        \ldclient\GetBootOptions
                        set /a err = %errorlevel%

                         

                        :diskfix
                        if %err% gtr 0 goto enddiskfix
                        \ldclient\Diskinfo fix
                        :enddiskfix

                         

                        @rem now check for provisioning.
                        \ldclient\GetBootOptions /v provisioning
                        set /a prov = %errorlevel%

                         

                        Getbootoptions.exe is the key.  I don't know exactly what it does as of yet, but if it sets the errorlevel to greater than 0, provisioning runs.  note that in the check for provisioning, getbootoptions is run and then the variable 'prov' is set to the errorlevel.  the rest of the commands in the startnet.cmd check to see if prov is greater than 0.

                         

                        Remove the line that copies down the .sif file from the OSD script and have a separate one copy down.  if you go to any of your PXE representatives and search under <driveletter>:\Program Files\LANDesk\PXE\System\images\x86pc\undi\provwin you'll find a SIF file that looks different from that of the one in the boot image -- here's a copy of the one on my PXE rep sans the server name.

                         

                         

                        [setupdata]
                        BootDevice = "ramdisk(0)"
                        BootPath = "\i386\system32\"
                        OSLoadOptions = "/noguiboot /fastdetect /minint /rdimageoffset=0 /rdpath=peboot.img /provisioning=true /corename=<MYCORESERVERNAME>"

                        • 9. Re: force computer to reboot and automatically start scheduled provisioning template
                          Apprentice

                          OKAY:

                           

                          I've figured it out -- I'll put together a little how to and post it separately, since the 'solution' requires some text manipulation.  This was a great idea - thanks for thinking outside of the box as I'm sure this'll help quite a few folks!  Here are the details:

                           

                           

                          A few things that I noted when I was trying to test: diskinfo.exe has a (new) command line parameter  - update_winnt_sif.  It creates a new winnt.sif file based on whatever path and file name you give it -- the script passes "%LDMS_CLIENT_DIR%\winnt.sif.new", meaning that it creates a new sif file in the C:\Program Files\LANDesk\LDClient directory by default.  The content of the new sif file is then copied into the boot image via copyfile as winnt .sif in the next command of the script:

                           

                          "%LDMS_CLIENT_DIR%\ldvpe0.img" "%LDMS_CLIENT_DIR%\winnt.sif.new" \winnt.sif

                           

                          the contents of the sif file? They're here:

                           

                          [setupdata]
                          BootDevice = "ramdisk(0)"
                          BootPath = "\i386\system32\"

                          OSLoadOptions = "/noguiboot /fastdetect /minint /rdimageoffset=0 /rdpath=multi(0)disk(0)rdisk(0)partition(1)\ldvpe1.img"

                           

                          Note the difference between this and the winnt.sif on your PXE rep

                           

                          OSLoadOptions = "/noguiboot /fastdetect /minint /rdimageoffset=0 /rdpath=peboot.img /provisioning=true /corename=<MYCORESERVERNAME>"

                           

                          If you were to add the  /provisioning=true and /corename=xxx to the bootoptions it would boot to provisioning.  One thing to caution though -- diskinfo is run to identify the partition that the OS is located on.  If you had your OS running on the second partition, the rdpath would refer to partition(2) instead of 1.  The reason I mention this is because my original idea was to copy down a modified winnt.sif which is then injected into the Windows PE image via copyfile -- you could always write a vbscript to do it (i'll have a look at that and get back to you).  For now I've decided to keep it simple

                           

                          create a file called prov_winnt.sif on your core server that reads as follows, replacing <MYCORESERVERNAME> with the name or IP of your core:

                           

                           

                          [setupdata]
                          BootDevice = "ramdisk(0)"
                          BootPath = "\i386\system32\"

                          OSLoadOptions = "/noguiboot /fastdetect /minint /rdimageoffset=0 /rdpath=multi(0)disk(0)rdisk(0)partition(1)\ldvpe1.img /provisioning=true /corename=<MYCORESERVERNAME>"

                           

                          copy the file to the system and then use copyfile to inject that file -- then bootfile will reboot and you should be into provisioning. If you are running laptops or desktops with hidden recovery partitions or something of that sort you'll have to adjust the rdpath accordingly.  Also, note that copyfile went a bit bananas when trying to use the provisioning variable %LDMS_CLIENT_DIR% in the path, so you may find it easier to hard code the path (or set the working directory).

                           

                          If you run into any issues shoot me a msg and I'll explain in more detail.

                           

                          -DT

                          • 10. Re: force computer to reboot and automatically start scheduled provisioning template
                            Rookie

                            David,

                             

                            This is exactly what I was looking for!! Sorry if what I was asking was not initially making sense.  I will give this a try and let you know (and award you your well deserved points afterwards!)

                             

                            Thanks for all of the time you put into this...

                             

                            BLarsen

                            • 11. Re: force computer to reboot and automatically start scheduled provisioning template
                              Rookie

                              David,

                               

                              Just looking through another OSD .ini script, I think there might be more to it that what you listed.  It would seem as though you would need to run the lddefrag.exe utility as well as possibly the bootfile.exe?  When you say in your previous post: "copy the file to the system and then use copyfile to inject that file -- then bootfile will reboot and you should be into provisioning." Is that what you meant? (to use bootfile.exe to force the reboot)  Have you tried this in your own environment?

                               

                               

                              Just a few thoughts before I unplug my brain for the rest of the day!

                              • 12. Re: force computer to reboot and automatically start scheduled provisioning template
                                Apprentice

                                You are correct -- my apologies for not being more specific.  After copying down the files using the download file actions, you will need to use the execute file action to run copyfile.exe.  This will insert the winnt.sif into the ldvpe0.img file.  Then use the execute file action again to run lddefrag to defragment the image.  Lastly run bootfile to cause the system to reboot to the PE image.

                                 

                                I've had a few issues getting the command line parameters for copyfile and diskinfo to behave in the provisioning template (which caused me to push them to a batch file, which I download and execute), but otherwise it works fine.

                                • 13. Re: force computer to reboot and automatically start scheduled provisioning template
                                  Apprentice

                                  If you can hold off until this time tomorrow I'll post the full template and details~ I'm out of office sick (which gives me plenty of time to do a few things to clean up the way I have done this).

                                  • 14. Re: force computer to reboot and automatically start scheduled provisioning template
                                    Rookie

                                    No worries!  I am sorry to hear that you've got the gombu! I really appreciate all of your help.

                                     

                                    -blarsen

                                    1 2 Previous Next