none
Restart and Resume RRS feed

  • Question

  • I'm writing a massive custom script for my company. Currently I have about 12 separate ones that, when run separately work fine. I'm trying to create just one script from all 12 however I 'm stuck.

    Currently I have my task sequence steps as such

    Part1
    Part2
    Part3
    Part4
    >Restart Computer
    (Just a default step added in the task sequence)
    Part5 ...
    ...Part12

    The restart computer step is what I am interested in.  In my task sequence I just click on "Add>General>Restart Computer"  and it works fine, what I would like to know is what script does this step call?  I looked inside DEPLOYMENTSHARE\Scripts however there isn't a script called RestartComputer.wsf or PS1.

    Can anyone elaborate so I can simply call that step from within my custom script?

    Thanks.


    Friday, August 22, 2014 12:44 PM

Answers

  • Restarting the computer step is one of the few steps in the MDT LiteTouch collection of Task Sequence steps that is a built-in primitive of the SMS Stand Alone Task Sequencer, rather than a MDT script.

    This primitive will schedule the reboot with the Task Sequencing engine, then the Task Sequencing engine will save it's state and return a reboot request to Litetouch.wsf. Litetouch.wsf is responsible for additional state configuration and initiating the actual reboot.

    It is *NOT* recommended to initiate a reboot from your script directly running as a step within the Stand Alone Task Sequencer. However, if you have a script that needs to make the call whether or not MDT should reboot, then look at what ZTIApplications.wsf does:

    If iRetVal = 3010 then  ' Reboot requested
    	' Set properties to indicate a reboot is needed and this script should be re-executed
    	oEnvironment.Item("SMSTSRebootRequested") = "true"
    	oEnvironment.Item("SMSTSRetryRequested") = "true"
    	oLogging.CreateEntry "Exiting to initiate a reboot with retry (to pick up where we left off)", LogTypeInfo
    	Exit Function
    End if

    Additionally, if you want to auto logon to continue, you would need to set the correct credentials for the local administrator account in Litetouch.wsf. %AdminPassword% and the like...


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Saturday, August 23, 2014 1:14 AM
    Moderator

All replies

  • I created a custom TS with only a Restart Computer step and this is what the ts.xml shows:

    <sequence version="3.00" name="Custom Task Sequence" description="Sample Custom Task Sequence">
      <step type="SMS_TaskSequence_RebootAction" name="Restart computer" description="" disable="false" continueOnError="false" runIn="WinPEandFullOS" successCodeList="0 3010">
        <defaultVarList>
          <variable name="SMSRebootMessage" property="Message"></variable>
          <variable name="SMSRebootTimeout" property="MessageTimeout">60</variable>
          <variable name="SMSRebootTarget" property="Target"></variable>
        </defaultVarList>
        <action>smsboot.exe /target:WinPE</action>
      </step>
    </sequence>


    -Nick O.

    Friday, August 22, 2014 2:47 PM
  • Thanks Nick.  Not quite sure what to do with that info.  How can I get that into my Powershell script and make it work?  I've read that its important to let MDT suspend the task sequence and save the state properly before rebooting.  So I want to tread carefully.

    I can obviously script the RunOnce registry settings along with setting credentials for reclogging on, its just I want to suspend the task sequence script until after a reboot carefully and properly but there seems to be no information on that whatsoever.


    MCP, MCTS, MCITP, MCSA.. Gunning for MCSE www.deploymentshare.com (New website/blog as of June 2014)

    Friday, August 22, 2014 8:40 PM
  • Restarting the computer step is one of the few steps in the MDT LiteTouch collection of Task Sequence steps that is a built-in primitive of the SMS Stand Alone Task Sequencer, rather than a MDT script.

    This primitive will schedule the reboot with the Task Sequencing engine, then the Task Sequencing engine will save it's state and return a reboot request to Litetouch.wsf. Litetouch.wsf is responsible for additional state configuration and initiating the actual reboot.

    It is *NOT* recommended to initiate a reboot from your script directly running as a step within the Stand Alone Task Sequencer. However, if you have a script that needs to make the call whether or not MDT should reboot, then look at what ZTIApplications.wsf does:

    If iRetVal = 3010 then  ' Reboot requested
    	' Set properties to indicate a reboot is needed and this script should be re-executed
    	oEnvironment.Item("SMSTSRebootRequested") = "true"
    	oEnvironment.Item("SMSTSRetryRequested") = "true"
    	oLogging.CreateEntry "Exiting to initiate a reboot with retry (to pick up where we left off)", LogTypeInfo
    	Exit Function
    End if

    Additionally, if you want to auto logon to continue, you would need to set the correct credentials for the local administrator account in Litetouch.wsf. %AdminPassword% and the like...


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Saturday, August 23, 2014 1:14 AM
    Moderator
  • Keith, Many thanks for the info!

    I have decided against doing what I had originally intended and have opted to split my script into two parts.  Part one runs then I put in a Restart sequence as normal and finally after the reboot part two runs. I've tested it and it works fine. 

    No point re-inventing the wheel. 

    Thanks again for the help and advice.

    Jonnie.


    MCP, MCTS, MCITP, MCSA.. Gunning for MCSE www.deploymentshare.com (New website/blog as of June 2014)

    Monday, August 25, 2014 11:08 AM