Ben Hunter

Architect - Microsoft Enterprise Services - Redmond

BDD 2007 - How to create a Custom task sequence with reboots

BDD 2007 - How to create a Custom task sequence with reboots

  • Comments 15
  • Likes

I am often asked how to setup a custom task sequence that will continue after a reboot.

If you have created a custom task sequence to install a number of applications that includes a reboot then you will know the problem I am taking about. When you do this you will find that the computer will reboot and then return to the logon prompt. The computer does not automatically logon :(. So you logon manually and BDD does not continue, so you have to manually launch the litetouch.wsf script :(. Then FINALLY the script will continue happily, until next next reboot at least.

Well I don't find this very convenient and I bet you don't either. So I have created a script that will setup required components to allow the BDD processes to continue as they would in a normal BDD deployment process.

The script configures three main components:

  1. Populates the required auto logon keys in the registry
  2. Populates the MININT folder with the scripts required to launch the script at when the client reboots
  3. Configures the BDD script to launch at reboot by creating a shortcut to the litetouch.wsf script in the "all users" startup folder
  4. Configures the correct phase information so that BDD knows what phase it should process

I find this script very useful, hopefully you find this script as useful as I do.

To implement the script follow the steps detailed below:

Update the deployment point rules

The script uses the ADMINPASSWORD property specified using BDD rules to determine the password that should be used for the local administrator account. If this is not correct then you can change the following line from the script to correctly reflect the value you want to use:

 oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", oEnvironment.item("AdminPassword"), "REG_SZ"

Update the scripts folder

Next you must add the script to the .\distribution\scripts folder. You will notice that the script names have the prefix "Z-" this is because BDD automatically copies all scripts that start with "Z" from the distribution share to other deployment points when they are updated.

Update the build task sequence

The next thing you do is add the scripts to the build task sequence. I would recommend creating an application for each script that executes a script and then add it to the task sequence as shown below. It is important to note that the "CUSTOM TS - Setup for reboot " task is run before the first reboot is performed.

image

Update your deployment points

Finally you should update your deployment points to so that these changes are propagated to the correct places.

For more information about custom task sequences then please refer to the following links:

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use.

Attachment: Z-SetupForAutologon.zip
Comments
  • Hi,

    The script doesn't seem to find the correct Admin password for Windows XP Lite Touch installations.  Is the best alternative to hard code the password in the script?

    Why do you recommend creating an application for each script?

    Also, any chance that you could please share the CONFIG-... scripts shown in the screen shot?

    Thanks for a great blog.

  • Hi Marcel,

    The admin password should be gathered from your customsettings.ini file. You you have a line in there that looks something like this?

    AdminPassword=Password

    Thanks,

    Ben

  • Ben,

    Your script creates a shortcut in startup folder to Litetouch.wsf located in %deployroot%\Scripts, but OS don't have credentials to connect to %deployroot% after restart and autologon :(

    The shortcut created by the script should point to c:\minint\scripts\Litetouch.wsf, am i right?

    Thanks in advance,

    Andy

  • Hi Andy,

    You are correct. My script assumes that you have rights to the distribution$ share.

    If you do not have rights then you will need to pre populate the C:\minint\scripts folder and then point the shortcut to there. I will have a look at this over the next few days and get back too you.

    Thanks,

    Ben

  • Hi Andy,

    I have updated the script with the changes you suggested. Give it a go and see what you think.

    Thanks,

    Ben

  • Ben,

    Your script is working great.

    Thanks

    Andy

  • Hi Ben,

    I've been struggling with getting my autologon to work in MDT for the last few days.  FINALLY, I came across this article.  I would like to clarify a few things.

    1)Update cs.ini: AdminPassword=Password, update Deployment Point.

    2)Create a Z-SetupForAutoLogon.wsf and put the following information into the script:

    oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", oEnvironment.item("AdminPassword"), "REG_SZ" Save to /Distribution/Scripts directory.

    3)Update the TS before the first reboot.

    "I would recommend creating an application for each script that executes a script and then add it to the task sequence as shown below. It is important to note that the "CUSTOM TS - Setup for reboot " task is run before the first reboot is performed."

    I'm not following you on this note.  Create an application for each script that executs a script and add it to TS....?

  • I like to create an application for each of my scripts where possible. By this I mean that I don't just chuck all of my scripts into the scripts folder and execute them from there.

    So create a new application that has source files. Place the script in the application folder and then call the script from the application command line, for example:

          cscript script.vbs

    You can add that application into your task sequence.

    Thanks,

    Ben

  • Ben,

    This helped out tremendously.  I cannot thank you enough.  Your blog has been one of the best resources for MDT topics.  I appreciate your willingness to share this information.  

    Best regards,

    Rich

  • I've upgraded to MDT recently and since have had an issues with litetouch deployments and autoadminlogon.  I deploy my custom wim with no issues.  The standard Vista setup goes through fine but when the system reboots it the autoadminlogon does work.  It says incorrect username or password.  If I enter the credentials manually it logs in and litetouch starts it's thing and the build finishes.  I've confirmed the autologon entries are in the unattend.xml file correctly and verified them several times.  This was not an issue when using BDD2007.  Any thoughts?  Do I need to use the script solution you provide here.  I'm not using a custom task sequence.

  • Hi Scott,

    These settings have not changed between BDD and MDT.

    Did you check the entries in the unattend.xml in the from \windows\panther\unattendgc folder?

    Thanks,

    Ben

  • Ben,

        Thanks for the response.  I have checked the \windows\panther\unattend.xml file and the settings are correct in there.  There is no unattend file in \windows\panther\unattendgc.  In the unattendgc folder there is only 4 files.  Diagerr, diagwrn, setupact and setuperr.  The unattend has this for autologon

    <AutoLogon>

        <Enabled>true</Enabled>

        <Username>Administrator</Username>

        <Domain></Domain>

     <Password>*SENSITIVE*DATA*DELETED*</Password>

        <LogonCount>999</LogonCount>

    </AutoLogon>

    Is there any reason autologon would work even with the above settings?  Is there any location where this event is logged.  I checked the event viewer and there are no entries for the login attempt.

    Any help is appreciated.

  • Unfortunately I can not think of any other reason why this  might not work if it worked with BDD 2007.

    I would suggest that you try posting the question at the following location, the broader audience may help.

    http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.deployment.desktop

    Thanks,

    Ben

  • is this required if you have configmgr and mdt?

  • Hi Brad,

    This is not required for ConfigMgr but it is required for MDT.

    Thanks,

    Ben