none
Recovery Environment

    Question

  • I am using MDT 2010 Task Sequences to deploy Windows 7 to my client's machines. 

    I need to know how to modify or create a new WinRE solution that provides for an OEM Factory Restore option in the Recovery Environment on the PCs that I will be deploying using MDT.  I will not be changing my deployment solution to another type deployment solution.  I will not go to a thick imaging solution and will be sticking with using task sequences.

    I want to use a task sequence to deploy Win7 that has the proper settings necessary that when I capture an image at the end of the task sequence it can be copied to the local PC as the image to restore from.

    Later on if a client boots to F8 and hits OEM Factory Restory it will restore the computer to the image that I captured at the end of my task sequence.

    I have multiple clients, so that restore image will be different per client but the recovery image can be the same.

    I have used the white paper, "Creating a Windows Vista Hard Disk Recovery Solution" and modified it for Windows 7 successfully.

    How do I integrate that with MDT instead of using the WinBits ConfigSet? 

    Can I just rename the recoverydrv.wim to winre.wim and copy it locally during the task sequence and overwrite the the winre.wim that is setup by default?

    Wednesday, November 24, 2010 1:34 PM

Answers

  • Ok so I have been working on this a lot lately and I have it working completely.  I know a lot of this is redundant if you have read this whole topic but here is a step by step of what I did to successfully accomplish this.  I started out by adding the SkipCapture=YES to my customsettings.ini

    1. Create a Standard Client Task Sequence

    2. Preinstall\New Computer Only\Format and Partition Disk - Created a new partition of 15GB and called it Recovery.  Selected Quick Format.

    3. Install\Install Operating System - Changed partition to 2

    4. State Restore - Created a Run Command Line after the last Windows Update line and named it Diskpart Start. In the command line I put diskpart.exe /s "%SCRIPTROOT%\Custom\Start.txt" 

    5. I created a folder called Custom in the Scripts folder in the root of the deployment share.

    6. I created a text file in deploymentshare$\scripts\custom folder called start.txt.  In it I typed

    • select disk 0
    • select partition 1
    • remove
    • assign letter = r

    7.  State Restore - Created a Run Command Line after Diskpart Start and named it Run Reagentc.  In the command line I put "%SCRIPTROOT%\Custom\reagentc.bat" 

    8. I created a batch file called reagentc.bat in the Custom folder.  In it I typed

    • md r:\recovery\windowsre
    • c:\windows\system32\reagentc.exe /setosimage /path r:\recovery\windowsre /target c:\windows

    9.  State Restore - Created a Restart Computer step after Enable Bitlocker to clear out any potential reboot request from updates or software that my block Sysprep

    10. State Restore\Prepare to Capture Image - Removed task sequence variables from this group.  This will perform the step regardless of the answer provided during Litetouch Wizard.

    11. State Restore\Prepare to Capture Image\Copy Sysprep Files - Changed the command line to cscript.exe "%SCRIPTROOT%\LTISysprepOEM.wsf"

    12. Opened LTISysprep.wsf in the Scripts folder and saved it as LTISysprepOEM.wsf.  I changed these settings and saved the new file.

    Class LTISysprep

    to

    Class LTISysprepOEM
    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /generalize /oobe /quit"

    to

    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /oobe /quit"

    13. State Restore\Capture Image - Removed task sequence variables from this group. This will perform the step regardless of the answer provided during Litetouch Wizard.

    14. State Restore\Capture Image - I removed the step about mass storage drivers as I am dealing only with Windows 7.

    15. State Restore\Capture Image - I copied the previously created Run Command Line called Diskpart Start and pasted it before the Create WIM step.

    16. State Restore\Capture Image - Created a Run Command Line after Create WIM step and named it Diskpart Finalize. In the command line I put diskpart.exe /s "%SCRIPTROOT%\Custom\Finalize.txt" 

    17. I created another text file called Finalize.txt and saved it to the Customs folder.  In it I typed

    • select disk 0
    • select partition 1
    • remove letter = r
    • set id 27 override
    • exit

    18. State Restore\Capture Image\Execute Sysprep - Changed command line to cscript.exe "%SCRIPTROOT%\LTISysprepOEM.wsf"

    19. State Restore\Capture Image\Create WIM - Changed command line to cscript.exe "%SCRIPTROOT%\ZTIBackupOEM.wsf"

    20. I opened ZTIBackup.wsf from the Scripts folder and saved it as ZTIBackupOEM.wsf.  I changed these settings and saved the new file.

    Class ZTIBackup to Class ZTIBackupOEM
    Every entry called bUseLocal = False needs to be changed to True

    Next change the following entry.

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " """ & sBackupPath & """ """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    to

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " R:\Recovery\WindowsRE\Install.wim """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    21. State Restore\Restore User State - I disabled this step as it was causing it to error out and I am not restoring any data.

    22. State Restore\Restore Groups - I disabled this step as it was causing it to error out and I am not restoring any data.

    23. TEST! TEST! TEST!  Do not go to step 24 until you have TESTED IT THOROUGHLY!!

    24.  Save task sequence and then go to the Control folder in the root of the deployment share and find the folder that matches the Task Sequence ID you created.  Open it and you will find a file called TS.xml.  Copy this file to c:\program files\microsoft deployment toolkit\templates folder.  In c:\program files\microsoft deployment toolkit\templates rename Client.xml to Client.old.  Rename the file that you just copied from TS.xml to Client.xml.  Now every time you create a new task sequence and use the Standard Client Task Sequence template it will have these settings already in it.

     

    Stephan,

    Thanks for all of your help as there is no way I would have gotten this without your help.

    Carlos

    • Marked as answer by ahijado05 Wednesday, January 12, 2011 4:36 AM
    Wednesday, January 12, 2011 4:35 AM

All replies

  • Hello,

    I don't think that this scenario is supported by default, however it is very possible.

    I don't have the time right now to explain in detail..

    But I can give you a rough draft of what I have setup myself, and I believe this is comes close to what you're looking for.

    I work for a system builder, because of that I have to deal with lots of different hardware, and also software. We practicly build stuff to order, this means that almost every install is different and I wanted to get rid of my "generic" recovery installation .wim file and build a task sequence that captures the just newly installed OS onto the recovery partition after my technicians are done with the pc.

    So in short, this is how my newly deployed customers pc os install sequence look like.

    1. Install OS (Created 2 partitions, one partition with a size of 5-6gb for recovery image and winre, and the rest is the remaining disk space where windows will be installed to)
    2. OS Boots into Audit mode, Install default apps, branding OS, windows updates.
    3. Suspend the task sequence, in this time it gives the technicians to check if everything is installed. Also during this time they will run system stability test tools to put the pc under max load conditions for an hour.
    4. Once that is done, they can continue the task sequence and this will sysprep (without /generalize otherwise I lose specialize pass settings again) the pc for OOBE, then it boots into windows PE, and captures the image into the recovery partition. After this is done the pc can be shipped to a customer.

    Once a customer completes the OOBE, and goes into the Advanced Recovery options, they are able to re-install windows from there (and also create a backup of their data).

    Or press F8 (this is default, can specify another key if you wanted) and select the option "Repair Your PC" which will also boot into WinRE providing them an option to reinstall the pc.

    Would this be something you're looking for?

     

    Wednesday, November 24, 2010 4:08 PM
  • This is exactly the concept that I am looking for with a few tweaks.  There is no need for me to do a load test.  Also I am working directly with the user so when I hand off the computer it is not in OOBE but given to them with their profile setup and all the onsite tech needs to do is transfer data.

    1.  The partitions I have created and added a diskpart run command line that moves the recovery partition to the r: drive.

    2.  Audit mode.  I don't have a need for this as I will not be repackaging the PC.  I will be installing all the apps and settings through steps in the TS and then will take the recovery image just before adding it to the domain and logging in as the user.

    3.  This step is not needed.

    4. This is the step that has been troubling me.  Can you please provide detail in how you dd this within the TS?

    After that you allow the customer to go through OOBE but in my situation my techs will do that for them and then add it to the domain and log in as the user.  Then they will test the F8 and Advanced Recovery options.

    I just dont want my techs to have to do much to accomplish the Recovery Environment setup.  As much as I can automate the better.

    Thanks so much for your help!

    Friday, November 26, 2010 2:08 PM
  • Hi,

     

    Sure I'll help, but right now I don't have the time for it, I'll get back to you on monday or tuesday for this!

    However, could you tell me wether the unattended file from the task sequence should be used for the sysprep command, or if you have created a custom unattended file that you planned on using for sysprepping the machines. And wether or not you need the images to be generalized (if you don't plan on using these images on other pc's, and don't plan on cloning the hdd's you will not need this.. it'll also speed up the first boot experience and if any customizations made that would be configured during the specialize pass, will not be lost).

    Let me know once you find the time, and I'll try and provide you with the necessary info to do this during the week.


    If you found a post helpfull, please click on "Mark as answer".
    Saturday, November 27, 2010 7:50 PM
  • I don't have any intention of using the image anywhere else but as the image restored during the recovery process.

    Right now I  am currently letting the default setup in the task sequence image the machine after deployment leveraging the customsettings.ini using SkipCapture=No.  The tech is putting in the location and name of the image.  I have written a powershell script that asks them what they named it and then copies it locally to the r:\recovery\windowsre folder.  

    I have tried calling this command in the powershell script

    c:\windows\system32\reagentc /setosimage /path r:\recovery\windowsre /target c:\windows  

    but I have not successfully gotten it to work that way.  Windows 7 by default automatically sets up the Winre at c:\recovery\{7843d69-fbb2-11df-8621-00215a69c954}.  I am assuming that reagentc /setreimage is not necessary sense it is pre-setup.  I have tried reagentc /enabled afterwards as well.  I have gotten this process to work on a desktop manually but not in a script.  

    I wonder if the fact that my test machines are VMs have anything to do with it as it has worked on the one desktop but no them.

    I assume you have a different process for this?

    Wednesday, December 01, 2010 4:31 PM
  • Hi,

    I don't have access to my files right now at work since the machine is turned off. But yeah I do it a little different. By default, MDT will not allow you to create a system image on the local disk when you capture the OS, but it wants this on a network location. I changed 2 scripts a little bit (really not much at all) so that sysprep is executed without the generalize option, since there's no need for that for a recovery image. And next to that I've modified the script that performs the imagex command, to write the recovery image to the "R:\Recovery\WinRE" path directly.

    The reagentc actually does need to be configured before it's sysprepped.

    I'll gather all info tomorrow at work and will try to compile a well organized post during the weekend for you.


    If you one of these posts answered your question or issue, please click on "Mark as answer". If a post contained helpfull information, please be so kind to click on the "Vote as helpful" button :)
    Thursday, December 02, 2010 11:11 PM
  • Hi,

    As promised I would provide the method I'm currently using to create a system image on the local HDD without first needing to be stored on a network location (since by default on a newcomputer scenario mdt disables localpaths for capturing).

    Please take note of the following.

    My recovery partition is the first partition of Disk 0, this is hidden by using set id=27, it will contain my bootmgr, winre.wim and install.wim which will be captured at the very end of the TS.

    During the partition and format disk step, I configured 2 partitions to be created, one partition of 6gb for boot and RE. The rest as OS.

    Also make sure that the OS installed on the proper partition, since by default it is installed onto partition 1.

    While you are in audit mode, you must run the reagentc command. Use diskpart to run a small script to assign your RE partition the drive letter R. You said that you have 1 winre.wim file that you can use with every pc, so create the folder structure on the R: drive and copy the winre.wim file to R:\Recovery\WindowsRE. After that run the 2 following commands.

    c:\windows\system32\reagentc.exe /SetREImage /Path R:\Recovery\WindowsRE /Target C:\Windows
    c:\windows\system32\reagentc.exe /SetOSImage /Path R:\Recovery\WindowsRE /Target C:\Windows

    I suggest you create a small batch file that does all this for you, and then execute that batch file from the TS.

    First off I created 2 copies of current scripts, I copied ZTIBackup.wsf to a File named ZTIBackupOEM.wsf and LTISysprep.wsf to LTISysprepOEM.wsf (I wanted to keep the original files so I could use their normal functions too).

    Since I created this when I had not much time available, I'll admit that there are nicer ways to do this, but I needed something working fast.

    Edit the ZTIBackupOEM.wsf file and change the following entries.

    Class ZTIBackup to Class ZTIBackupOEM
    Every entry called bUseLocal = False needs to be changed to True

    This will ensure that the wim file will be created on the local disk.

    Next change the following entry.

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " """ & sBackupPath & """ """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    to

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " R:\Recovery\WindowsRE\Install.wim """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    This will bypass the BackupPath variable, and simply store the file at the path specified.

    Save the file, and then open LTISysprepOEM.wsf and change

    Class LTISysprep

    to

    Class LTISysprepOEM
    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /generalize /oobe /quit"

    to

    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /oobe /quit"

    I took out the generalize setting since that is not needed if the images are going to be used as restore images on only that particular system. It avoids certain issues regarding to programs that might not work very well or cause issues when a pc is started for the first time once a pc starts after sysprepping, and it speeds up the general first boot experience.

    You will also need 2 small scripts for diskpart.

    I called this one start.txt

    select disk 0
    select partition 1
    set id 7
    remove
    assign letter=R
    select partition 2
    remove
    assign letter = C
    exit

    and the next one finalize.txt

    select disk 0
    select partition 1
    active
    remove letter=r
    set id 27 override
    
    

    For testing purposes I suggest you first create a new task sequence, edit that to include the follwing.

    In the execute sysprep step; change the command line to be executed to [cscript.exe "%SCRIPTROOT%\LTISysprepOEM.wsf"]

    After the gather local only step, add a run command line to load the diskpart script that assigns the letter R to the recovery partition. Name it to something you like, and then add the following command line to be executed [diskpart.exe /s "%SCRIPTROOT%\start.txt"]

    After that it will execute the step to create the wim file.

    Once the wim file has been created, I added a step to hide the recovery partitition again. Add another run command line step in the task sequence, which executes the following command [diskpart.exe /s "%SCRIPTROOT%\finalize.txt"]

    Since the apply windows pe step actually configures the bootmgr onto the drive where the OS is installed onto, and I personally don't want this for my customers, I delete the bootmgr again from the OS partition and marked the Recovery partition as active again. My reason behind this is because if users cannot mess with these files by accident, there's a higher chance their system wont need to be repaired.

    Please take note of the partition numbers I used, yours might differ from mine, since I opted to put the WinRe.wim, Install.wim and bootmgr all on the same hidden partition. Since out of experience with the wide variaty of hardware we work with, having 3 partitions causes problems with AHCI disk initialization (the layout of bootpartition, recovery partition and remaining space for windows partition)

     

    I hope you can make sense of all this :D. I still plan on actually creating a much nicer solution for this when I actually have time for it, but for now this will suffice.

    Once you have your test sysprep and capture task sequence all working, just copy the changes into your current OS deployment task sequence.


    If you one of these posts answered your question or issue, please click on "Mark as answer". If a post contained helpfull information, please be so kind to click on the "Vote as helpful" button :)
    Monday, December 06, 2010 10:00 AM
  • Stephan,

    Thanks that is a mouth full!  I understand everything that you did and will try it as soon as I get a chance. 

    A couple things though just to be thorough...

    1. Windows 7 by default sets up WinRE in a hidden folder called Recovery on the c:\ drive.  Do you use the UninstallRE option in your answerfile to remove that or do you not even bother.  I ask this because I haven't successfully been able to get reagentc /setreimage to work in a different path without disabling it.  Does your method require it or should I not worry.

    2.  Does you customsettings.ini contain SkipCapture=Yes and it is set to automatically run Sysprep and create the WIM.  If so what do you do to get it to run because when I had that setting it just skipped over the capture part of the TS.  If you have it as NO then what do you put in when it asks if you want to capture an image.

    3.  For your WinRE.wim...do you pull it from the standard one or do you modify it.

    4.  When do you put your diskpart in the TS on the first one and again on the 2nd one.  I put mine as the first step of the last section (State Restore, I think) that encompasses the Custom Tasks and Capture steps.  I assume you put the 2nd one just after the capture steps.

    • Marked as answer by ahijado05 Wednesday, January 12, 2011 4:36 AM
    • Unmarked as answer by ahijado05 Wednesday, January 12, 2011 4:37 AM
    Tuesday, December 07, 2010 1:33 AM
  • Hi,

    Glad that it was at least comprehensible :D

    1. By default, if you create a new reference image by working with the audit mode there should be no C:\Recovery\{GUID} folder present. I did not change anything from my unattend.xml. I did do a test for you though, and I can confirm if WinRE is enabled, which means it already has a WinRE Image value (you can check that with ReAgentc.exe /info), then you will not be able to use the /setreimage command. I suppose you could always just include a disable command before running the  /setreimage command if you're running into problems.

    2. I skip all wizard pages except the Task Sequence and Applications to install (my technicians need to be able to install additional optional software), furthermore there are no settings defined in my customsettings.ini file about the capture at all. In a "standard client install task" the capture state is bound to conditions. I first simply created a sysprep and capture TS, and made my changes for the template there untill everything worked. Once that was done, I copied the entire "Capture Image" folder of that TS, into my OS install TS's, as the very last step to be executed. If it's not clear I can make a screenshot later on.

    3. This is the default WinRE.wim file which is located at C:\Windows\System32\Recovery\WinRE.wim. However, I added additional MSD drivers to this image so that I only need to have 1 RE image for all my OS deployments, and that way customers dont need to load drivers manually.

    4. My diskpart steps are indeed executed right before, and right after the wim is created.


    If you one of these posts answered your question or issue, please click on "Mark as answer". If a post contained helpfull information, please be so kind to click on the "Vote as helpful" button :)
    Tuesday, December 07, 2010 1:16 PM
  • Well, tried it going through exactly how you have it but it did not work exactly.  I haven't had a whole lot of time to play with it though.

    I had a few problems that I can overcome.  One of my problems is that sysprep will not work when automatic updates is asking for a reboot.  I need to go through and use DISM to update my WIM file so that there are no updates when Automatic Updates runs.  I tried disabling the Windows Update service but that will just create more work down the line and DISM will speed up the deployment as we wont have as many updates to worry about afterwards. 

    I am having a problem with the SkipCapture=Yes in the customsettings.ini.  If I put it in then it wont capture the image and effectively just skips that part.  If I don't put it in then it asks during Litetouch and doesn't allow you to select a local partition as the destination.  I tried to tell it to do it to the network and hoped that the settings you told me to put in the ZTIBackupOEM file would override it and put it locally but it just gave an error.

    I am also having a problem with the installation setting up the WinRE in the default location in the hidden Recovery folder on C:\ drive.  I think it is because my install.wim is from the Dell OEM CD.  I can use the UninstallWinRE command in my answer file to stop it or I may just not use the SetREImage command in the batch file.  I am going to try the route of using the c:\recovery\{}\ location so that it is less work and if that doesn't work then I will use the answer file to stop it and then copy the winre to the r:\ drive.

    Unfortunately this is my last week of the year and I am currently studying for 70-686 so I am not sure if I will have time to work on it much more before I leave. I will update when I try to work on it more.

    Monday, December 13, 2010 11:45 AM
  • Hi,

    Sorry to hear it does not quite work for you. Would you want me to upload an archive of my cs.ini, ts.xml and custom scripts so you can see what I'm working with?

    Your issue with sysprep not being able to execute when WU still has pending updates that need a reboot, is to initialize a reboot within the TS between the WU step, and Sysprep.

    I'm currently working on getting my certifications as well, though I still try to help people out when I can. It should not matter what the source of your install.wim is from to be honest.

     


    If you one of these posts answered your question or issue, please click on "Mark as answer". If a post contained helpfull information, please be so kind to click on the "Vote as helpful" button :)
    Monday, December 13, 2010 11:59 AM
  • Well, I am testing something right now although I have to leave and wont see the result until tomorrow.  I removed the variable from the Sysprep and Capture steps of the TS so that they wont rely on my answer in Litetouch and will run anyway.  I hope that works.

    Yeah I thought of the reboot option but in the end I will have a TS for each client which would be 130+ and that would be a lot of extra work especially if I ever wanted to take it out.  Instead I opted to go with mounting the WIM that most of the TS's will use and select add-package to add the updates that I gathered through WSUS and WSUSOffline.

    I really appreciate your help so far as you have definitely put me down the right path.  I will let you know how my test goes and if removing the variables is a valid option or not.

    Monday, December 13, 2010 1:48 PM
  • Ok I am back on it now, sporadically.  I have done some things and got it to almost work.  Here is what I have done.

    1.  Preinstall\New Computer Only\Format and Partition Disk\

    I added a 15GB partition called Recovery and changed the name of the OSDisk to Windows

    2. Install\Install Operating System\

    I changed the partition to 2

    3. State Restore\

    I added a Run Command Line and named it Diskpart Start.  I used this command diskpart.exe /s "%SCRIPTROOT%\Custom\Start.txt"

    I created a folder called Custom in the Scripts folder of the Deployment Share.

    I created a text file called Start.txt in the Custom folder and added the syntax

    select disk 0
    select partition 1
    remove
    assign letter=R

    I added a Restart Computer after Windows Update to restart due to Sysprep not working if a restart is needed.

    I created another Run Command Line called Run RDrive.bat that runs just before the BitLocker option.  The command line syntax is "%SCRIPTROOT%\Custom\RDrive.bat"

    Rdrive.bat was created in the Custom folder with the syntax of md r:\Recovery\WindowsRE

    4.  I added SkipCapture=YES to the customsettings.ini

    5.  I disabled the Prepare Capture Image group in State Restore and the  Execute Sysprep setting in the Capture image group in State Restore on the TS so that it will skip Sysprep.

    6.  I removed the Task Sequence Variable from the Capture Image group in State Restore in the TS so that it will run this regardless of the answer during Litetouch.vbs.

    7. I disabled the Add mass storage drivers to sysprep.inf for XP and 2003 in the Capture Image group in State Restore.

    8. I disabled Restore User State and Restore Groups as I do not use these settings.

    9.  I created the ZTIBackupOEM file as you said to do and change the command line to use the new file in the Create WIM step of the TS.

     

    I decided to leave Sysprep out completely so that the Reinstall Windows option in RE will put the PC in a working condition.  I am not sure if that is how I will use it in the end but for now that is how I plan on using.  The image will only be used on the machine that it was created on so I don't really see the need to go back through the Windows Setup.  I have done this in practice on a few machines manually and it seems to work fine.

    I am going to allow Windows to setup WinRE on its own and just use the /SETOSIMAGE command and the /enable command.  For now though, I am just mainly concerned with getting the TS to actually create the image on the R: drive.  Then I will put in the steps to setup RE and hide the drive.

    I do get an error with the ZTIBackupOEM though.  The error message says...

    • Error creating an image of drive E:, rc = 2
    • ZTI ERROR - Non-zero return code by ZTIBackupOEM, rc = 2
    • Litetouch deployment failed, Return Code = -2147467259 0x80004005
    • Message from the task sequence engine:
    • Failed to run the action: Create WIM.
    • The system cannot find the file specified.  (error: 00000002; Source: Windows)
    • blah blah blah :P

    I haven't had a chance to play with it except that I confirmed that the Create WIM step had the correct syntax that wasn't misspelled and said ZTIBackupOEM.wsf.  I confirmed that the file is in the Scripts folder and is not misspelled.  I deleted it and recreated it following your instructions. 

    Any ideas?
    Friday, January 07, 2011 3:44 PM
  • Ok so I have been working on this a lot lately and I have it working completely.  I know a lot of this is redundant if you have read this whole topic but here is a step by step of what I did to successfully accomplish this.  I started out by adding the SkipCapture=YES to my customsettings.ini

    1. Create a Standard Client Task Sequence

    2. Preinstall\New Computer Only\Format and Partition Disk - Created a new partition of 15GB and called it Recovery.  Selected Quick Format.

    3. Install\Install Operating System - Changed partition to 2

    4. State Restore - Created a Run Command Line after the last Windows Update line and named it Diskpart Start. In the command line I put diskpart.exe /s "%SCRIPTROOT%\Custom\Start.txt" 

    5. I created a folder called Custom in the Scripts folder in the root of the deployment share.

    6. I created a text file in deploymentshare$\scripts\custom folder called start.txt.  In it I typed

    • select disk 0
    • select partition 1
    • remove
    • assign letter = r

    7.  State Restore - Created a Run Command Line after Diskpart Start and named it Run Reagentc.  In the command line I put "%SCRIPTROOT%\Custom\reagentc.bat" 

    8. I created a batch file called reagentc.bat in the Custom folder.  In it I typed

    • md r:\recovery\windowsre
    • c:\windows\system32\reagentc.exe /setosimage /path r:\recovery\windowsre /target c:\windows

    9.  State Restore - Created a Restart Computer step after Enable Bitlocker to clear out any potential reboot request from updates or software that my block Sysprep

    10. State Restore\Prepare to Capture Image - Removed task sequence variables from this group.  This will perform the step regardless of the answer provided during Litetouch Wizard.

    11. State Restore\Prepare to Capture Image\Copy Sysprep Files - Changed the command line to cscript.exe "%SCRIPTROOT%\LTISysprepOEM.wsf"

    12. Opened LTISysprep.wsf in the Scripts folder and saved it as LTISysprepOEM.wsf.  I changed these settings and saved the new file.

    Class LTISysprep

    to

    Class LTISysprepOEM
    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /generalize /oobe /quit"

    to

    sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /oobe /quit"

    13. State Restore\Capture Image - Removed task sequence variables from this group. This will perform the step regardless of the answer provided during Litetouch Wizard.

    14. State Restore\Capture Image - I removed the step about mass storage drivers as I am dealing only with Windows 7.

    15. State Restore\Capture Image - I copied the previously created Run Command Line called Diskpart Start and pasted it before the Create WIM step.

    16. State Restore\Capture Image - Created a Run Command Line after Create WIM step and named it Diskpart Finalize. In the command line I put diskpart.exe /s "%SCRIPTROOT%\Custom\Finalize.txt" 

    17. I created another text file called Finalize.txt and saved it to the Customs folder.  In it I typed

    • select disk 0
    • select partition 1
    • remove letter = r
    • set id 27 override
    • exit

    18. State Restore\Capture Image\Execute Sysprep - Changed command line to cscript.exe "%SCRIPTROOT%\LTISysprepOEM.wsf"

    19. State Restore\Capture Image\Create WIM - Changed command line to cscript.exe "%SCRIPTROOT%\ZTIBackupOEM.wsf"

    20. I opened ZTIBackup.wsf from the Scripts folder and saved it as ZTIBackupOEM.wsf.  I changed these settings and saved the new file.

    Class ZTIBackup to Class ZTIBackupOEM
    Every entry called bUseLocal = False needs to be changed to True

    Next change the following entry.

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " """ & sBackupPath & """ """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    to

    sCmd = "cmd /c """"" & sImagex & """ /capture /compress maximum " & oDrive.Path & " R:\Recovery\WindowsRE\Install.wim """ & sPrefix & Left(oDrive.Path, 1) & "Drive"""

    21. State Restore\Restore User State - I disabled this step as it was causing it to error out and I am not restoring any data.

    22. State Restore\Restore Groups - I disabled this step as it was causing it to error out and I am not restoring any data.

    23. TEST! TEST! TEST!  Do not go to step 24 until you have TESTED IT THOROUGHLY!!

    24.  Save task sequence and then go to the Control folder in the root of the deployment share and find the folder that matches the Task Sequence ID you created.  Open it and you will find a file called TS.xml.  Copy this file to c:\program files\microsoft deployment toolkit\templates folder.  In c:\program files\microsoft deployment toolkit\templates rename Client.xml to Client.old.  Rename the file that you just copied from TS.xml to Client.xml.  Now every time you create a new task sequence and use the Standard Client Task Sequence template it will have these settings already in it.

     

    Stephan,

    Thanks for all of your help as there is no way I would have gotten this without your help.

    Carlos

    • Marked as answer by ahijado05 Wednesday, January 12, 2011 4:36 AM
    Wednesday, January 12, 2011 4:35 AM
  • Glad to have been of help, I would have responded sooner but was a bit too busy to check the forums.
    If you one of these posts answered your question or issue, please click on "Mark as answer". If a post contained helpfull information, please be so kind to click on the "Vote as helpful" button :)
    Wednesday, January 12, 2011 8:46 AM
  • Hello,

     

    Firstly thanks for posting this, it is exactly what I have been looking for, but I appear to be having an issue getting it working fully. It gets to the point to run the disk part and reagentc but does not reboot and do the image capture. Any assistance / pointing in the right direction would be much appreciated.

     

    Kind Regards,

     

    Andy 

    Wednesday, August 17, 2011 9:53 AM
  • Ah think I am having the problem of my ini file has skipcapture=yes, removed the variable from the task and retrying, hopefully that will just be the issue.
    Wednesday, August 17, 2011 11:16 AM
  • Yes, on the Capture Image Group you should remove the "Task sequence variable DoCapture equals YES" variable so that it will do the capture regardless of what your CustomSettings.ini says.  Also remove the variable from the Prepare to Capture Image group.
    Wednesday, August 17, 2011 11:23 AM
  • That'd be indeed a reason why it would skip the capture, however if you want to keep the setting within your customsettings.ini file, simply remove the variable from the task sequence itself, such as Ahijado05 suggested.
    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    Wednesday, August 17, 2011 12:11 PM
  • Cheers for that, I seem to be getting 1 step further then 4 steps back... the disk part was reassigned R: to partition 1 before I removed Task sequence variable DoCapture equals YES" but now doesn't want to and trying to run it manually after the image gives me the following error:

    "assigning or removing drive letters on the current boot or pagefile volume is not allowed."

    On checking the pagefile is on drive D: (as it didn't get assigned to R)not sure where I have gone wrong.

     

    Wednesday, August 17, 2011 3:14 PM
  • If I understood you right I believe you are talking about the Diskpart step that runs finalize.txt after the image was taken.  Is that correct?
    Wednesday, August 17, 2011 3:22 PM
  • It looks to be diskpart.exe /s "%SCRIPTROOT%\Custom\Start.txt" which contains:

    select disk 0

    select partition 1

    remove

    assign letter = r

     

    I have just renamed the task and am rerunning the image to confirm the task as I have 2 tasks called Diskpart Start...

    Wednesday, August 17, 2011 3:50 PM
  • I would add a Run Command Line just before the step that executes LTISuspend so that it will suspend the TS.  Then when it stops I manullay run diskpart to make sure that the numbers are right for your system.   Is it really disk 0?  Is it really partition 1? 

    Mine is actually set to partition 2 and this may be where you are having problems.  I may have either missed typed.  If you have the TS setup one partition and you shrink it with diskpart then the new partition should be 2.  Again put a Suspend step just before so you can test it.  When I was first coming up with this and testing it I had about 8 suspends in it so I can play with it at different steps.

    Wednesday, August 17, 2011 6:28 PM
  • I've now gotten further :-)

    The diskpart is all working, I get as far as the sysprep and it appears to work but does not reboot Win PE and the deployment says its complete but gives me the following error on the log:

     

    FAILURE (6191): Test for Clonetag in registry to verify sysprep completed. - unable to open registry key "HKLM\System\Setup\Clonetag" for reading

     

    Any ideas why it would fail at this point? any logs that will assist?

     

    Does the sysprep actually need to be run, as this recovery wim is only going to be applied to this machine? I did try it without the syspre but it didnt work.

    Sunday, August 21, 2011 6:48 PM
  • You could edit the LTISysprep script to comment out the two registry checks, I found it to cause me issues as well eventhough Sysprep executed properly.

    It's not actually a requirement to execute sysprep at this point, however since I work for a System Builder, I opted to do this so that when a user does make use of the recovery partition to re-install Windows, they will be prompted with exactly the same interface as the first time they booted up their pc.

    You could also opt to disable the Execute Sysprep task in the task sequence and add a run command line action that executes sysprep for you "C:\Windows\System32\Sysprep\Sysprep.exe" /quit /unattend:{path to unattend.xml file if you want to automate the OOBE for example}

     

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    Sunday, August 21, 2011 9:23 PM
  • Excellent thanks for the info, wasn't expecting a reply tonight (22:00 UK time here, nothing like working on my imaging project late on the weekend!). Have passed the sysprep now and booting to PE but had an error creating the wim, trying it again now. 

    Thanks again for all the assistance, have found a definite lack of info out there for the more advanced functions of MDT so you guys rock :-)

     

    Regards,

     

    Andy

    Sunday, August 21, 2011 9:38 PM
  • Awesome I am glad it is working out for you so far.  As for the creating of the WIM, if you have more problems put a Suspend step just before it and attempt to manually create the WIM.   Run imagex and if it fails it will tell you why and you will be able to fix it.  I had the problem once and found that I wasn't creating a large enough recovery partition because that client requested about 8 extra applications to be installed first.

    Carlos

    Sunday, August 21, 2011 11:17 PM
  • Success! Pretty much anyways. Found I hadn't put a diskpart for the Windows PE so my "R" drive didn't exist for the create wim create to save to. The deployment process finishes successfully but when I restart to Windows I get a message box stating that it could not find C:\minint\scripts\litetouch.wcf which is as expected as after the create wim step I have no other steps in my TS. But I cant find what is causing this to appear and as the logs are deleted at the end of the TS I don't have anything to look at, any thoughts?

    I wonder if instead of finishing the deployment in PE if I rebooted to Windows then the TS completed it would resolve the error, I did put a reboot at the end of create wim but it just rebooted back to PE not sure how to make it boot back to windows in the script.

    One final random question... My applications list is getting fairly large, is there any way to collapse the list. For instance I have a folder in my list for each model then within each folder then applications to install. As the list is automatically expanded by default it looks messy and cumbersome to navigate.

     

    Cheers guys!

     

    Andy

    Tuesday, August 23, 2011 10:59 AM
  • Great!  I am glad you have had success.

     

    If you figure out how to get it to boot into windows and then end the TS please let me know as I cannot figure it out and there are still some scripts I want to run afterwards.

    For your error.  You should be able to check the logs if you do not click ok to the error.  Once you click ok to the final summary it cleans the logs out.

    As for the applications. .. It sounds like you have a lot of applications and regardless of how you sort them there will be a lot of folders.  If you were to sort them by the make of the app then you would have one folder for every vendor.  Either way it is a lot of folders.  I have read up on people altering the Wizard to use drop down menus instead.  Maybe that is something to look into.

     

    Carlos


    Respectfully, Carlos MCTS, MCITP
    Tuesday, August 23, 2011 11:46 AM
  • Cheers, found an easy solution for the application list, if you create a new application root folder and move all your application folders into this one MDT expands the root folder only, so it looks clean again.

    I'll let you know if I sort out the solution to the PE reboot saga, thanks again for all the help.

    Tuesday, August 23, 2011 12:49 PM
  • It would be very nice if you could upload your files cs.ini, ts.xml and custom scripts  is it possible? Thanks in advance!
    Thursday, September 22, 2011 9:52 AM
  • The ones that really make this work are the ts.xml but unfortunately they are way to big to post on here.
    Respectfully, Carlos MCTS, MCITP
    Thursday, October 27, 2011 2:06 PM
  • Hi all,

    This thread really rocks, I was thinking about doing something like that for a while but I never really tried.
    I think it's time!

    Thanks a lot! 
    Mathieu Ait Azzouzene | Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene
    Monday, January 16, 2012 9:58 PM
  • Awesome, I am glad that is able to help someone!
    Respectfully, Carlos MCTS, MCITP
    Sunday, January 29, 2012 5:10 PM
  • Appearently this still is one of the things people are having issues with seeing the amount of views of this topic.

    Since the large amount of posts, I've decided to consolidate all the information I once gave here on my blog while cleaning up the code itself some more.

    I've created a package that contains a MDT 2010 ts.xml template, along with the necessary script files to get the recovery partition to work.

    If you still havent managed to get it yet to fully work, try reading my post at: http://www.stephan-schwarz.net/?p=77 and download the files provided at the bottom to see if that would be of any assistance, I've checked it multiple times and I'm 100% it works.

     

    Kind regards,

    Stephan Schwarz

     

     


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    Sunday, January 29, 2012 8:30 PM
  • Thanks for the information Stephan!

     

    Quick question for you, is the unattend file you provided in your blog for 64 bit installations only?

    Tuesday, January 31, 2012 5:22 PM
  • Yes, that's a unattend.xml file a 64 Bit version of Windows 7. However it is the default unattend.xml that is used by MDT, with only 1 addition which is the OOBE Mode configured as Audit.

    Using WSIM you can find this under  the "x86_Microsoft-Windows-Deployment_neutral" component.

    Expand that, go to reseal, and add that to the oobeSystem pass (7) then change the mode from OOBE (default) to Audit.

     

    Edit; I've also created the RunSynchronousCommands used to execute the MDT Task sequencer upon loading Windows, in the auditUser pass, since if they were to remain in the oobeSystem pass. The OS would just stop doing anything after booting into Audit mode right after leaving the install OS stage.

     

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    Tuesday, January 31, 2012 6:11 PM
  • Thanks for the quick response!

     

    Ok I was able to update the unattend.xml with the oobesystem pass(7) and change it to Audit mode. The Task Sequence runs like I want it to until it boots into Audit mode, but then the task sequence does not seem to start backup. The logs don't show any errors, the TS just never seems to reinitiate. I am going to play around with it a little. If anyone has any suggestions I would greatly appreciate it.

     

    Edit: I just saw your edit, looks like that is what I am running into.

    • Edited by Grimnex Tuesday, January 31, 2012 7:35 PM
    Tuesday, January 31, 2012 7:33 PM
  • I've updated the archive to include an unattend.xml for a 32-Bit Windows 7.

     

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT
    Wednesday, February 01, 2012 7:07 AM
  • Thank you! I was able to run through the Task Sequence succesfully using your ts.xml and unattend.xml as a reference.

     

    When I go to test the recovery image when it boots to WinRE I am getting a "Windows Cannot find a system image on this computer" is this something wrong with my winre.wim?

    Wednesday, February 01, 2012 6:13 PM
  • Can you verify the presence of the Install.wim file on the recovery volume?

    Also you can verify the status of the WinRE configuration using [reagentc.exe /info] from a command prompt (might need to run from administrative command prompt). I maybe have seen that error you're talking about a very long time ago, but there can be multiple problems that cause it.

    Please provide the output of reagentc /info and computer configuration (is the hard disk part of a raid-array, or located on a mass storage device that requires drivers before disks are detected on it?)

     

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT
    Wednesday, February 01, 2012 9:08 PM
  • Yes I am able to see the Install wim on the recovery volume.
    Here is ReAgentC /info when ran through an elevated cmd in windows.
    C:\windows\system32>reagentc /info
    Extended configuration for the Recovery Environment
    
        Windows RE enabled:   1
        Windows RE  staged:   1
        Setup enabled:        1
        Custom Recovery Tool: 0
        WinRE.WIM directory:  \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\Wi
    ndowsRE
        Recovery Environment: \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\Wi
    ndowsRE
        BCD Id:               d6d45899-4d05-11e1-b045-e89a8f0e4a8d
        Setup Files:          \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\Wi
    ndowsRE
        Recovery Operation:   5
        Operation Parameter:
        Boot Key Scan Code    0x0
    REAGENTC.EXE: Operation successful
    The computer is pretty generic with just a hitachi SATA drive not in any raid-array, I dont believe any mass storage drivers are required. 
    Wednesday, February 01, 2012 9:26 PM
  • I have a few question regarding this all WinRE thing:

    _Do you use the default winre.wim or do you create one via DaRT? I tried using the default WinRE and when I wanted to reinstall setup stopped because of a wrong product key in the unattend.xml file... the product key is OK so I don't understand.

    _I don't want to sysprep the machine, I want the computer to be the same after as it was before capturing. I disabled the sysprep step but MDT didn't suppress LiteTouch.lnk from the All Users startup folder so I added those lines to my ZTIBackupOEM.wsf.

    '[CUSTOM] Lines added: Delete LiteTouch
    If oFSO.FileExists(oShell.SpecialFolders("AllUsersStartup") & "\LiteTouch.lnk") then
    oFSO.DeleteFile oShell.SpecialFolders("AllUsersStartup") & "\LiteTouch.lnk"
    End if
    '[CUSTOM]

    What do you think about it?

    Thanks for all.


    Mathieu Ait Azzouzene | Viadeo: Mathieu Ait Azzouzene| Linkedin: Mathieu Ait Azzouzene


    Friday, February 10, 2012 9:02 AM
  • I'm about to leave for vacation so I can't really provide much help for the upcoming week.

    I've used the default WinRE image that is supplied with every Windows 7/Server 2008R2 version. I've never tested a WinPE image created from MSDaRT but it might work as well. You can open up the command prompt first (if triggering the recovery during boot) and then let the recovery procedure start. And then debug from there, checking the unattend.xml file (could be more then one are located and a wrong one perhaps is used? again, not sure why this occurs in your case). What Windows edition are you trying to make this work with? One thing worth noting perhaps, is that in my task sequences I do not provide product keys during the deployment so not in the unattend.xml from the task sequence nor a variable.

    It should be possible to do exactly what you're trying to do now, using the code from LTISysprep to remove the litetouch.lnk.

    I can confirm that creating a recovery image w/o running sysprep will work without problems though, this is one of the other scenario's that I have created and have running as well. So the error regarding the product key is not related to trying to redeploy your RE image w/o sysprep.

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT


    Friday, February 10, 2012 10:58 AM
  • Thanks for your quick reply,

    I'm trying to make this work with Windows 7 Enterprise, I can deploy and activate Windows but I can't reinstall...it's weird.
    I mounted R:\Recovery\Windowsre\install.wim to check the unattend.xml, the product key is OK.

    I will investigate.

    Thank you for your time.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Friday, February 10, 2012 11:39 AM
  • What do you mean by debugging from there? I don't know what can I debug from the command line before launching the recovery procedure.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene| Linkedin: Mathieu Ait Azzouzene



    Friday, February 10, 2012 12:52 PM
  • I simply meant using the command line to help you track where/why it goes wrong. You should read the log files that the setup creates. Also try to ommit the product key from installation for now and see if that makes a difference.

    This'll be my last message for now, I'll check back in a week if you haven't managed to get it working.

    Regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Friday, February 10, 2012 2:02 PM
  • When I leave the product key empty it works fine...

    Anyway enjoy your vacation!

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Friday, February 10, 2012 2:39 PM
  • You can activate the OS through VAMT or through KMS afterwards, another option is to extend the TS to boot back into Windows and add your product key in a new step in the TS using vlmgr.

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Friday, February 10, 2012 3:16 PM
  • Hello,

    Firstly Stephan thanks for the work you have done on this I know it has helped me and loads of others!

    I have a bit of trouble which I'm hoping someone can help me out with...

    The task sequence all completes fine but for some reason, when I reboot the PC and press F8 to get up the advanced boot option I don't see a "Repair this computer" option.

    The other thing I'd like to do but am not sure how to is after the recovery wim is created at the end I would like it to boot back to windows.

    Incase this buggered something up, I have used my own answer file as I dont need to sysprep the image.

    I'd be grateful for any help

    Andy


    • Edited by AndyAmos Wednesday, February 15, 2012 6:37 PM
    Wednesday, February 15, 2012 6:34 PM
  • Hello AndyAmos,

    I have the exact same problem when I use Stephan task sequence, the "Repair this computer" option disappears!
    I'm working on it and I'll let you know if I'll make this work.

    Regarding booting back to windows at the end of the task sequence, try adding finishaction=REBOOT in your CS.ini.

    Mathieu

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Wednesday, February 15, 2012 6:41 PM
  • On doing bcdedit /enum all on a working PC and a non-working PC I seem to be missing this bit on the "broken" ones.

    Device options
    --------------
    identifier              {4ffbbc57-1548-11e1-b052-001f29ad85bd}
    description             Ramdisk Options
    ramdisksdidevice        partition=C:
    ramdisksdipath          \Recovery\4ffbbc56-1548-11e1-b052-001f29ad85bd\boot.sdi

    So this does appear what is causing the issue, I'm just trying to see how to add in an entry to the BCD pointing it at the correct recovery partition to prove this resolves it before looking into adding it to the build process.

    Thursday, February 16, 2012 11:04 AM
  • Also trying to use the recovery partition "online" by:

    Start > Control Panel > System and Security > Backup and Restore >  click Recover system settings or your computer > Advanced > Reinstall Windows 

    Also fails.

    I can't disable reagentc either I get

    REAGENTC.EXE: Operation Failed: 2

    The system cannot find the file specified

    • Edited by AndyAmos Thursday, February 16, 2012 12:27 PM More info.
    Thursday, February 16, 2012 11:38 AM
  • I found the problem, when not doing the sysprep the reagentc doesnt seem to work without the system being in audit mode. Allowed it to go to audit mode run the sysprep and the reimaged PC now has a correct recovery boot.
    Friday, February 17, 2012 10:06 AM
  • What do you mean by allowing it to go to audit mode?

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Monday, February 20, 2012 10:28 AM
  • the unattend.xml that Stephan provided (in the control\ts folder) sets the sysprep to go into audit mode. But as I replaced it with my own it stopped it going into audit mode which is apparently needed to allow the reagentc command to run correctly.
    Monday, February 20, 2012 10:58 AM
  • Regarding the reagentc command, you can make it run correctly by adding reagentc /disable at the beginning of your script and reagentc /enable at the end.
    I don't see the aim of going into audit mode.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene| Linkedin: Mathieu Ait Azzouzene


    Monday, February 20, 2012 12:47 PM
  • hi,

    does anybody knows how to prevent reboot after capturing image? When capturing finish computer restart, i dont want that, i need shutdown. I use script

    Stephan Schwarz

    thx in advance

    Monday, February 20, 2012 1:22 PM
  • Hi Dragan,

    You can add a custom variable "FinishAction" to the task sequence, or add it in the customsettings.ini file if you want that for every TS to happen.

    Open your TS, go to the Task Sequence tab: Add > General > Set Task Sequence Variable. The TS Var should be FinishAction and the value should be Shutdown.

    Or add the following to your cs.ini

    FinishAction=Shutdown

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT


    • Edited by Stephan Schwarz Monday, February 20, 2012 4:32 PM
    • Proposed as answer by Petar Biga Tuesday, February 21, 2012 8:36 AM
    Monday, February 20, 2012 4:32 PM
  • Hi there,

    I'm back from my vacation and noticed on my phone there were made several posts in this thread, however I can't really type a long post on a mobile phone since it's just too much of a hassle, hence the delay.

    As Mathieu already figured out, if you do not use Audit mode, REAgentC will fail to configure WinRE paths, since it's already active. It first needs to be disabled with the /disable switch, then execute the OSimage and REimage paths and then use the /enable switch again. Keep in mind this needs to be done from an administrative command line if you're trying to do this manually.

    The reason I chose to work with the Audit mode, is purely because I came from an OEM perspective where we actually worked with it. I will be working on a non-Audit mode task sequence template the following few days.


    Kind Regards,
    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Monday, February 20, 2012 4:56 PM
  • Thanks a lot, Stepahan

    if u have time, it will be nice if can to update your files on your blog with that changes about reagentc. Because i am not sure where i need to make those changes

    Tuesday, February 21, 2012 8:36 AM
  • Hi Dragan Ewe,

    You just have to add two lines in Enable-WinRE.cmd:

    Set DS=\\servername\deploymentshare$


    diskpart /s %DS%\Scripts\WinRE\AssignDriveLetter.txt
    c:\windows\system32\reagentc.exe /disable
    IF EXIST C:\Recovery RD C:\Recovery /q /s
    c:\windows\system32\reagentc.exe /SetREImage /Path R:\Recovery\WindowsRE /Target C:\Windows
    c:\windows\system32\reagentc.exe /SetOSImage /Path R:\Recovery\WindowsRE /Target C:\Windows
    c:\windows\system32\reagentc.exe /enable
    RD R:\_SMSTaskSequence /S /Q
    Exit

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene| Linkedin: Mathieu Ait Azzouzene


    Tuesday, February 21, 2012 8:51 AM
  • I'm still having trouble with the "Repair my computer" option disappearing after capture.

    I presume my problem comes from the Re-assign DriveLetter.cmd but I can't make it work.


    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Tuesday, February 21, 2012 9:35 AM
  • Can you try to manually run "reagentc /enable" after the task sequence has been completed just for testing purposes (from within Windows that is from an elevated command prompt).

    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Tuesday, February 21, 2012 10:15 AM
  • I am having a strange "problem" can soemone sense check this for me incase I'm being numb. After deploying the image (but before the recovery image is created) the system reboots all is good, but instead of autologging in with the password/account in the unattend.xml file I get a message that the password is incorrect. I enter the password fo rthe administrator account, it logs in fine and continues the process successfully. I have edited the password in Stephan's unattend.xml file in \\server\deployment\control\ts007\ but no joy, I have mounted the wim and checked the unattend.xml file in there too and the password is correct. I even removed the ' from LTISysprepOEM.wcf on file 107 I think it was to copy a separate unattend.xml from a UNC path to c:\windows\system32\sydprep but that didnt help either.

    What am I missing?

    Tuesday, February 21, 2012 11:36 AM
  • I manually ran "reagentc /enable", it fixed the "Repair my computer" missing option but when I try it nothing happens, computer starts normally.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Tuesday, February 21, 2012 12:58 PM
  • It's okay, I ran  "reagentc /disable" then  "reagentc /enable" and it works fine.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Tuesday, February 21, 2012 4:23 PM
  • Disabling sysprep causes trouble because all the cleanup tasks are stored in LTISysprep.wsf.
    I'll try to add a LTICleanup task to replace sysprep and tell you if it works.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Thursday, February 23, 2012 10:04 AM
  • hi Mathieu Ait Azzouzene,

    any success with adding LTICleanup task?

    thanks

    Friday, February 24, 2012 1:58 PM
  • Unfortunately no...

    I kept LTISysprepOEM.wsf in my task sequence to clean MDT files and registry, then I commented 3 lines in the script to avoid sysprep to run:

    ' Run sysprep
    'sCmd = oEnv("SystemRoot") & "\system32\sysprep\sysprep.exe /quiet /oobe /quit"
    'iRetVal = oUtility.RunWithHeartbeat(sCmd)
    'TestAndFail iRetVal, 6111, "Run Sysprep.exe."

    It works...in a way!
    The problem is the Repair my computer option disappearing after capture, I have to run "reagentc /disable" then "reagentc /enable" at first logon. The captured image has the same problem so every time I reinstall using WinRE I have to run "reagentc /disable" then "reagentc /enable"again.
    It's driving me crazy, I'm working on it for a week and still don't have any clue.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Friday, February 24, 2012 2:46 PM
    • Error creating an image of drive E:, rc = 2
    • ZTI ERROR - Non-zero return code by ZTIBackupOEM, rc = 2
    • Litetouch deployment failed, Return Code = -2147467259 0x80004005
    • Message from the task sequence engine:
    • Failed to run the action: Create WIM.
    • The system cannot find the file specified.  (error: 00000002; Source: Windows)
    • blah blah blah :P

    Carlos,
    This is great, Thanks!

    I followed your instructions as closely as I could, and  am having this exact same error after what i think is the last reboot when it is trying to create the image. It seems like the ZTIBackupOEM script is trying to write the image on the R drive, but since it is booted to WinPE the R drive doesn't exist. Any suggestions as to what I might have missed?

    Thanks again,

    Matt

    Monday, March 26, 2012 8:44 PM
  • Back when I created this, I used a small diskpart script called once restarted into WinPE but is executed prior the ZTIBackupOEM script.

    This would assign the drive letter "R" to the first partition on disk 0. You can see Carlos's post marked as answer on the top of the page; look for step 16 and 17.

    Alternatively, you can check out the link in my signature if you want a ready-to-use solution, only need to adjust a couple of filepaths.

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Monday, March 26, 2012 11:16 PM
  • Stephan is absolutely correct.  Drive letters can be manipulated using a diskpart script using the diskpart.exe /s command. 

    Respectfully, Carlos MCTS, MCITP

    Tuesday, March 27, 2012 11:40 AM
  • Mathieu,

    I would suggest attempting this without MDT first to see where your problem may lie.  I would use diskpart to setup the partitions just as you would if you were using MDT.  I would then take an image using Imagex /capture in a variety of ways.  I would run reagent /enable before and try with Sysprep in OOBE and Audit mode.  I would also try without using Sysprep.  I would use the RE to reinstall Windows in each situation until I got it to work.  Then I would incorporate that into MDT.  This is the standard process that I used to create the original walkthrough.  I suspect that your problem may lie in how you are preparing your image since you have the same problem after restoring from that image.

    Carlos


    Respectfully, Carlos MCTS, MCITP

    Tuesday, March 27, 2012 11:52 AM
  • Stephan and Carlos,

    Thanks so much for the quick replies. I am confused. Maybe it is because i am kind of new to MDT. Are you saying that the instructions don't work as is? As far as I know I followed them exactly. 

    I do see the R drive pop up when diskpart start runs. I can add another step before Create Wim that sets the drive letters. I just thought it should work without that.

    Here is my step 16 and 17. as far as i can see they run fine.

    Stephan,

    I tried your instructions first and ran into trouble with them also. Initally it would get all the way though, then wouldn't create the image on the recovery drive. Then i ran into issues with WSUS so i just disabled the steps that try to get updates.  Now the [custom] Close sysprep GUI step isn't working and i have no idea how to figure out why. as i say this i think maybe the updates changed something that allowed that to work. I will see if i can get it working with the local WSUS server here on campus.  (FYI, i tried to email you from your blog and the email came back)

    Thanks to both of you again for the help, and the guide.

    Sincerely,

    Matt

    Tuesday, March 27, 2012 1:50 PM
  • SmprFidels,

    When you say that it wouldn't create the image on the recovery drive, what do you mean by that?  Did it attempt to create it and could not find the target drive?  Did it not find the source drive?  Did it give you an error message?  The reason that I ask is that many different factors come into not being able to create the image.  If it could not find a R: drive then maybe you are having the same issues a Mathieu and need the diskpart step.

    Sometimes our instructions may not work perfectly due to many reasons.  Sometimes the reader misses a step.  Sometimes a computer behaves differently.  The drive letters assigned in WinPE do not always align exactly as they are in Windows which is why we are suggesting the diskpart /s step in WinPe to make sure that they are as the Create WIM step requires.  I originally started this as a way to figure it out.  Like me, there may be times when you have to tweak things to your environment because we all have different configurations that can change things.  I would suggest again to get the process working manually outside of MDT and then incorporating the steps that work for your environment into MDT.  I think of MDT as a way to "script" or "automate" the processes that I want to use.  I create my processes and standards manually and once I have them set the way that I want them I figure out the best way to automate them.  

    Hope this helps,

    Carlos


    Respectfully, Carlos MCTS, MCITP


    • Edited by ahijado05 Tuesday, March 27, 2012 2:08 PM
    Tuesday, March 27, 2012 2:05 PM
  • Stephan and Carlos,

    Thanks so much for the quick replies. I am confused. Maybe it is because i am kind of new to MDT. Are you saying that the instructions don't work as is? As far as I know I followed them exactly. 

    I do see the R drive pop up when diskpart start runs. I can add another step before Create Wim that sets the drive letters. I just thought it should work without that.

    Here is my step 16 and 17. as far as i can see they run fine.

    Stephan,

    I tried your instructions first and ran into trouble with them also. Initally it would get all the way though, then wouldn't create the image on the recovery drive. Then i ran into issues with WSUS so i just disabled the steps that try to get updates.  Now the [custom] Close sysprep GUI step isn't working and i have no idea how to figure out why. as i say this i think maybe the updates changed something that allowed that to work. I will see if i can get it working with the local WSUS server here on campus.  (FYI, i tried to email you from your blog and the email came back)

    Thanks to both of you again for the help, and the guide.

    Sincerely,

    Matt

    Hi Matt,

    Sorry about the email thing, my server has a hardware function right now preventing me to access most of my data. Including my exchange server; I've updated the email address for the time being, thanks for pointing that out.

    From what I can see in your task sequence, it's not executing a script to assign a drive letter "R" right before the [Create Wim] step in the Capture Image group.

    What should work is if you copy the "Diskpart Start" task and paste it right above the "Create Wim" step.

    Not sure why my task sequence template isn't working for you, however I can't test it's functionality for the same reason as stated above, I need to wait for a hardware replacement. I do know that it I've tested it in and out and it did work properly last time I ran it. Also as Carlos said, there are many factors that determine whether or not this works for you, since it's easy to miss a step or configure something you think has no effect on the task sequence where in fact it actually does something that does affect it's functionality.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Tuesday, March 27, 2012 2:24 PM
  • Carlos,

    When i said that it wouldn't create an image i mean that the task sequence ran to completion, but there was no image on the Recovery drive. 20G of a 20G drive was free space. it did have the recovery\windowsre folder path. Unfortunately i can't get back to even that stat now. My current problem with Stephan's instructions is still the [custom] Close sysprep GUI step isn't working and i have no idea how to figure out why. Turning back on the WindowUpdate steps didn't seem to help. the error says "there are no child process to wait for"

    As for your process the diskpart step definately helped. I think maybe i have been missunderstanding part of how this is used. When i presssed F8 i expected to do a system image restore, but am I maybe supposed to be selecting the reinstall-windows? That seems to work to at least reinstall windows, I thought this configuration would work more like restoring an image without having to have a separate bootable media. i think I need a new post.

    Thanks again for all the help figuring this out. it was definately educational.

    Sincere reguards,

    Matt

    Tuesday, March 27, 2012 3:04 PM
  • Please check the logs to see what is going on during your Create WIM step when you get a chance.  You may need to put the Trace32 installer on the WinPE image used and then when you see the Create WIM step happening hit F8 to open another command prompt.  In that command prompt run Trace32 and open the deployment logs.  This will allow you to watch the log as it is happening and you can see what is going on.  If ImageX is successful then the image would be there.  It has to be erroring out somehow.

    As for Stephan's Close Sysprep GUI step...I am not sure what step you are referring to but I would love to see if I can help.

    When you hit F8 and boot into the Recovery Environment you can have many different scenarios come up but by default there are really only two non-custom ones.  One of them is with the option to Reinstall Windows and the other is without.  The commands that are run at a command prompt with Reagentc.exe are what enable this option.  This is the option that you will want to use to restore to your custom image.  The /setreimage and /setosimage commands are what tell the system how to respond when you hit F8 and select Repair Your Computer.  If you have these enabled then the /setreimage tells Windows what WinPE image to boot from to load the Recovery Environment and the /setosimage command tells it to have the Reinstall Windows option and what image to load when that option is selected.  Once the option to Reinstall Windows is selected then you will go through a process to restore the computer from an image in the R:\Recovery\WindowsRE folder.  You should not need to boot to any media for this.  You can toggle the Repair Your Computer option on and off on the F8 menu by using the reagentc /enable and /disable commands.


    Respectfully, Carlos MCTS, MCITP

    Tuesday, March 27, 2012 4:29 PM
  • Thanks for the F8 tip, i didn't realize i could do that in WinPE, (shift F10 didn't work)

    The ZTIbackupOEM logs really don't show anything. I see the "About to run command: cmd...\imagex.exe" /capture..." in the log then ZTI Heartbeat notices up  to 30 minutes for ztibackupOEM and a ZTIBackupOEM processing completed successfully, but there is only the install.wim in the R:\Recovery\WindowsRE\ folder. I can't find any errors in them.

    For the Close Sysprep GUI step, it seems for some reason that sysprep was not running at that point, I disabled the step and now have nearly identical behavior as I do with your TS.

    Thanks for the description. I can't say i understand all of it, but it goes a long way to making me think that this might work.  The idea is to run something from a installed windows OS, select an image to restore, and have it reboot and restore that image. then reboot back into windows. I am hoping to later apply this to windows backup system images, maybe even from across a network.

    Sincerely,

    Matt

    Tuesday, March 27, 2012 7:46 PM
  • Okay so here is what I would do...

    1. Go into the boot folder of the deployment share and get the ISO. 
    2. Put imagex on the hard drive of the machine.
    3. Boot it to the ISO and when the Wizard comes up hit F8
    4. Run diskpart and look at your drive and see how it is presented within WinPE and confirm it does appear as it should if you were in the WinPE during the task sequence.  If it is great, if not...there is your problem.  This can sometimes be the wild card as you are never certain how WinPE will map the drives for every model.  An example of something that might cause it to differ is an external drive or an internal MicroSD card slot.  Sometimes it may give these drive letters before giving it to your hard drive's partitions. 
    5. If the drive letters are all right then manually run the ImageX command with the exact parameters that are in the ZTIBackupOEM file.  If this works properly and afterwards you see an image on the R: then you can go from there and figure out why MDT won't do it.  Likely though you will have an error and then you can use that error to troubleshoot.

    Sometimes you got to remember that MDT is only a bunch of scripts that automate manual tasks.  When you have problems it is always good to go back and manually perform the tasks first.  Then you know if it is MDT or something else. 

    As for the Close Sysprep GUI step, I guess I will need to go look at his steps to see what you mean.  I saw in my email that he posted his steps but I did not go look at them yet, sorry Stephan :).  I will take a look at them tonight or tomorrow and see if I can figure out the issue.


    Respectfully, Carlos MCTS, MCITP

    Tuesday, March 27, 2012 8:49 PM
  • Thanks for the F8 tip, i didn't realize i could do that in WinPE, (shift F10 didn't work)

    The ZTIbackupOEM logs really don't show anything. I see the "About to run command: cmd...\imagex.exe" /capture..." in the log then ZTI Heartbeat notices up  to 30 minutes for ztibackupOEM and a ZTIBackupOEM processing completed successfully, but there is only the install.wim in the R:\Recovery\WindowsRE\ folder. I can't find any errors in them.

    For the Close Sysprep GUI step, it seems for some reason that sysprep was not running at that point, I disabled the step and now have nearly identical behavior as I do with your TS.

    Thanks for the description. I can't say i understand all of it, but it goes a long way to making me think that this might work.  The idea is to run something from a installed windows OS, select an image to restore, and have it reboot and restore that image. then reboot back into windows. I am hoping to later apply this to windows backup system images, maybe even from across a network.

    Sincerely,

    Matt

    You state that you only see the install.wim file within your Recovery\WindowsRE folder. If you're missing the WinRE.wim file, you did not extract this from the base Windows installation. I'll quote the relevant info from my blogpost;

    "The WinRE.wim file can be found in the \Windows\System32\Recovery folder of a default Windows 7 or Server 2008 Install.wim image. The WinRE.wim image is not bound to a certain Windows Edition, however architecture type needs to be separated. This means if you use both x86 and x64 systems in your environment, you will need to extract both of these files. Please note; If you require special mass storage device drivers (for example sas/sata hba’s or raid controllers) you should include these in the WinRE.wim file, so the end-user does not have to load the driver manually."

    You will need to make sure that this file is copied onto the harddisk in the same WindowsRE folder as the install.wim file is located, without it's not possible to make it work.

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Tuesday, March 27, 2012 8:52 PM
  • Carlos,

    I think maybe this last problem was in my head. On the VM that i ran your TS on I have an install.wim in the R:\recovery\windowsre\ folder. For some reason i was thinking that there should be something else. (?) I do not have a WinRE.wim file there, but I think maybe with your process I don't need it? So the process for recovering a drive created with your TS is to press F8 during boot, select repair your computer to get into WindowsRE, then use the re-install windows option and follow the prompts, right?

    Thanks,

    Matt

    Wednesday, March 28, 2012 1:41 PM
  • Stephan,

    When i looked again at the vm created with your TS, there was a WinRE.wim in the correct folder with the Install.wim. As I told Carlos in my reply to him i think maybe i was expecting something different than the re-install windows option from the WinRE environment. If my notes to him are correct then it is time for me to move on to trying to use this partition to automate restoring a windows system image. by the way, do you know what step caused your system to only have the two partitions, and Carlos' TS to also have the BDEDrive partition.

    Thanks again,

    Matt

    Wednesday, March 28, 2012 1:51 PM
  • I quickly skimmed through the thread again;

    The reason why there's no WinRE.wim in Carlos's method, is because the WinRE.wim file is located at [ C:\Recovery\{GUID}\WinRE.wim ] (this is a protected folder you will first need to take ownership of). This is the default behaviour of Windows.

    Placing the WinRE.wim on the the recovery partition is the "best practice" method discribed in the various Microsoft documentation.

    What you discribe on the post directed to Carlos, the "Re-install" Windows option presented in the Windows PE environment, is actually what you created. This is the built-in Recovery mechanism provided by microsoft to facilitate the re-installation of Windows, using the Install.wim file that you placed on the recovery partition. Without any configuration on a pc, this option will not be available.

    As for the reason why you have a BDEDrive partition at the end of your HDD with Carlos's TS, it's because he's using the default partition and format HDD step in the task sequence, and did not set the variable of mdt DoNotCreateExtraPartition=YES. With that option set, you will not get the extra partition. However that's not the reason why it's not showing up in my task sequence; the reason in my case is because I do not use the default format and parition disk step, but instead call the script "Configure-HDD.cmd" which calls a diskpart script "Diskconfig.txt" (should be in the zip file you downloaded) and formats the HDD according to my recommended method.

    Can you discribe what it actually is that you are trying to create if you're not statisfied with the "Re-install Windows" option? If you want to replace that with a custom program, for example a script that simply runs imagex to apply the image on the hdd (maybe format it first if that's somethign you seek?) I can give you a document that should give you enough insight on how to do that. If you totally want to remove the selection menu and have it start the recovery right after you start PE (maybe with a warning screen or something like that to ask for confirmation before starting, you'll have to edit the PE environment a little bit).

    Kind regards,

    Stephan Schwarz


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Wednesday, March 28, 2012 2:34 PM
  • Yes, one solution for recovering the drive is to boot to the F8 and hit Repair Your Computer.  Another would be to boot to a Win7 disk and it will also be there.  Another is to hit the Windows Key and type Recovery.  Then select Advanced Recovery Methods and follow the prompts.


    Respectfully, Carlos MCTS, MCITP

    Wednesday, March 28, 2012 2:43 PM
  • My ultimate goal is two fold

    1. To do regular system image backups on each computer so that they can Remotely be restored to any available system image.

       a. be able to do a bare metal recovery of these system image backups to an identical computer. (not remotely).

    2. To deploy a computer with an image that can be restored remotely to factory settings.

    The first problem I ran into when manually testing using the OS default installation was this error message.

    I think the WinRE recovery environment seems to be helping with that and I am trying to test it further now.

    Thanks,

    Matt

    Wednesday, March 28, 2012 3:33 PM
  • 1. Doing regular system backups to work in the recovery environment will be very tricky because to take that image the partition needs to be offline.  This means you will need to remotely boot the system to WinPE and pull an image.  If you use the system backup utility to take an image it creates the image in a VHD.

    2. Deploying a computer from a custom Factory Restore is exactly what this post is intended for.  It creates an image of a PC after being configured by MDT and places that image on the Recovery partition all within the same task sequence.

    It has been a while since I have gone through the process to restore a computer but it looks like you are trying to format the partition that contains the WinRE that it is booted from which means you probably are leaving it in its original location as I have. 


    Respectfully, Carlos MCTS, MCITP

    Wednesday, March 28, 2012 3:48 PM
  • I was hoping i could use a backup of just the OS partition created while windows was running, but it doesn't let me restore the c drive backup, and it seems that if i do a system image, or -allcritical (I think they are likely the same thing) then it also backs up the recovery partition and wont allow me to restore just the C drive part.

    The custom Factory restore is working good now.  I am pretty sure most of my problems were from my missunderstanding the instructions.

    I will keep working on it,

    Thanks

    Matt

    Wednesday, March 28, 2012 8:53 PM
  • Hello:

    Can you please post a completed posting like on Wednesday, January 12, 2011 4:35 AM of the functional steps?

    My deployment errors on capture so i need to work through all the changes that have been made since January.  I will get the specific error i am having asap for everyone to review.




    Chris

    Monday, April 02, 2012 4:35 PM
  • I have not made any changes to mine since that posting and it still works for me today

    Respectfully, Carlos MCTS, MCITP

    Monday, April 02, 2012 4:39 PM
  • So if i do all the steps you list it should work without anything else?  I think i am missing steps then.  My deployment stops at the capturing image and crashes.  Crashes after 15mins.

    Im going to try imaging a unit within the hour and I'll let you know the specific error I get.  


    Chris

    Monday, April 02, 2012 4:46 PM
  • Stephan:

    I have downloaded and started using the files you provided on your site.  Can you supply me with a little help?  I am at the part that each of your files need modified.  I have figured out most of the changes other than the Configure-HDD.cmd file.  I know the two lines at the top are what needs changed i know the second line but where is this first line.  I don't know of any path to WINRE.wim other than the original.  Do i need to capture this from my Windows installation cd and save on my server?  


    Chris

    Tuesday, April 03, 2012 6:08 PM
  • Correct, you will need to extract the WinRE file from the Windows installation disk, or from a running OS. Save it anywhere you like and add the unc path to the variables. Make sure the the same account that connects to the MDT server, has access to the shared folder since it'll try to connect using the existing credentials.

    Location would be;

    Windows 7/Server 2008R2 Install.wim > mount > browse to mountdir\Windows\System23\Recovery\WinRE.wim

    Win7/Server 2008R2 Local install > C:\Recovery\{Guid}\WinRE.wim

    Win7/Server 2008R2 that started into audit mode upon very first boot > C:\Windows\System32\Recovery\WinRE.wim

    I dont host the WinRE.wim files since it would just create a file that's way to large to download. I like to keep the files as small as possible, hence just the scripts themselves.

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Tuesday, April 03, 2012 7:08 PM
  • Steven:

    Can you supply a sample of what the first two lines to Configure-HDD.cmd would be?  I have tried this and my deployment errors out.  Errors at [Custom] Configure HDD which is calling this cmd file.


    Chris

    Tuesday, April 03, 2012 7:36 PM
  • In my lab environment it's;

    SET REimagepath=\\MDT-01\Sources\WinRE ( Sources is a share I created for files that I dont include in my actual deployment share, for example because it's shared between multiple deployment shares)

    SET DS=\\MDT-01\DS-Test$

    I've extracted both a WinRE.wim image from a x64 and x86 OS, and renamed them "WinREx64.wim" and "WinREx86.wim" (now that I think of this, I never mentioned this anywhere in my post nor documentation, I'll update it to reflect this to be more clear)

    The script then checks whether it's running a x86 or x64 version of WinPE, and then copies one of the two .wim files, to the R:\Recovery\WindowsRE\WinRE.wim (note it's renamed back to WinRE.wim)

    Kind regards,

    Stephan Schwarz.


    If one of these posts answered your question or issue, please click on "Mark as answer".

    My Blog | Twitter: @Schwarz_Stephan | MCTS, MCITP, MCC.
    How to configure Windows RE/OEM Recovery Partition with MDT

    Tuesday, April 03, 2012 8:15 PM
  • Hi People,

    I have implemented this solution as above and it all works fine. The issue I am having is that everytime a recovery takes place it adds a new Windows 7 boot option in the BCD. Anyway to stop it doing this?

    Thanks

    Tuesday, April 10, 2012 2:52 PM
  • I'm dealing with the same issue.
    Let me know if you find something to avoid it.

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Monday, April 16, 2012 2:51 PM
  • I created a custom WinPE to restore the image using imagex. This solves the double entry issue.
    Tuesday, August 14, 2012 5:41 PM
  • Hi Casey,

    Could you explain what you've done to solve our issue?

    My Blog: DeployXP [Under Construction]| Viadeo: Mathieu Ait Azzouzene | Linkedin: Mathieu Ait Azzouzene

    Thursday, August 16, 2012 2:44 PM
  • My solution is very crude and my code is the like. But essentially what I did was create an autoit script that searches for the recovery image and the destination drive. Then it invokes imagex to apply the image to the destination. I'm no good at tutorials, but here's my brief overview at what I did, if you need clarification let me know.

    I take WinPE from the WAIK, mount it, and apply a couple packages to it (replace x86 with amd64 for 64 bit):

    Dism /image:c:\pe-x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\x86\WinPE_FPs\winpe-hta.cab"
    Dism /image:c:\pe-x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\x86\WinPE_FPs\winpe-mdac.cab"
    Dism /image:c:\pe-x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"
    Dism /image:c:\pe-x86\mount /Add-Package /PackagePath:"C:\Program Files\Windows AIK\tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"

    Then I create a folder called tools at the root of the WinPE. Inside the tools folder I put two folders, x86 and amd64 that contain the appropriate architecture of the script I made and imagex. Then you need to edit \Windows\Systems32\startnet.cmd, I delete any existing commands and repalce it with (replace x86 with amd64 for 64 bit):

    ..\..\tools\x86\restore.exe

    This invokes my script immediately on startup. Once everything is where it should be, I commit the image and name it WinRE.wim and place it on the recovery partition. Works like a charm.

    The autoit script restore.au3:

    #include <GUIConstantsEx.au3>
    #include <ButtonConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    #include <Constants.au3>
    #include <Array.au3>
    
    Global $restoreGUI,$ProcessID,$image,$destination
    
    Func findRecoveryImage()
    	Local $aDrives = DriveGetDrive("FIXED")
    
    	For $i=1 To UBound($aDrives)-1
    		If FileExists($aDrives[$i] & "\Recovery\WindowsRE\Install.wim") Then
    			$image = $aDrives[$i] & "\Recovery\WindowsRE\Install.wim"
    		EndIf
    	Next
    
    	If $image = "" Then
    		MsgBox(262192,"ERROR","No Factory Recovery Image was Found")
    		Shutdown(2)
    		Exit
    	EndIf
    EndFunc
    
    Func findDestination()
    	Local $aDrives = DriveGetDrive("FIXED")
    
    	For $i=1 To UBound($aDrives)-1
    		$space = DriveSpaceTotal($aDrives[$i])
    		If FileExists($aDrives[$i] & "\Windows") And Not FileExists($aDrives[$i] & "\Recovery\WindowsRE\Install.wim") And Not FileExists($aDrives[$i] & "\Windows\System32\startnet.cmd") Then
    			$destination = $aDrives[$i] & "\"
    			Return
    		ElseIf $space > 30000 And Not FileExists($aDrives[$i] & "\Recovery\WindowsRE\Install.wim") And Not FileExists($aDrives[$i] & "\Windows\System32\startnet.cmd") Then
    			$destination = $aDrives[$i] & "\"
    			Return
    		EndIf
    	Next
    
    	If $destination = "" Then
    		MsgBox(262192,"ERROR","Unable to determine destination")
    		Shutdown(2)
    		Exit
    	EndIf
    EndFunc
    
    Func createMenu()
    Local $restore, $devman, $msg
    Local $splash = @ScriptDir & "\splash.jpg"
    
    SplashImageOn("",$splash,800,600,0,0,1)
    $restoreGUI = GUICreate("Factory Operating System Restore",395,95,200,250,-1,$WS_EX_TOPMOST)
    
    $restore = GUICtrlCreateButton("Restore Operating System from Factory Image", 10,5,375)
    $restart = GUICtrlCreateButton("Restart System", 10,35,375)
    $shutdown = GUICtrlCreateButton("Shutdown system", 10,65,375)
    
    GUISetState(@SW_SHOW)
    
    While 1
    	$msg = GUIGetMsg()
    	Select
    		Case $msg = $GUI_EVENT_CLOSE
    			Shutdown(2)
    			Exit
    		Case $msg = $restore
    			GUISetState(@SW_MINIMIZE,$restoreGUI)
    			GUISetState(@SW_HIDE,$restoreGUI)
    			If MsgBox(262196,"**WARNING**","Restoring the OS will DELETE ALL DATA ON SYSTEM! Press 'Yes' to Continue with Restore, Press 'No' to Reboot") == 7 Then
    				Shutdown(2)
    				Exit
    			EndIf
    			$ProcessID = Run(@ScriptDir & "\imagex.exe /apply /scroll " & $image & " 1 " & $destination,"",@SW_HIDE,$STDOUT_CHILD)
    			showProgress($ProcessID)
    		Case $msg = $restart
    			Shutdown(2)
    			Exit
    		Case $msg = $shutdown
    			Shutdown(1)
    			Exit
    	EndSelect
    WEnd
    EndFunc
    
    Func showProgress($ProcessID)
    Local $SPLASH_TITLE = "OS Factory Restore"
    ;~ Reading the output from the processID
    ProgressOn($SPLASH_TITLE,"DO NOT Shutdown OR RESTART","",250,250)
    
    While 1
    	$fCurLine = StdoutRead($ProcessID) ;~ I read what the ProcessID write to the console
    	If @error Then ExitLoop ;~ Make sure to exit when the ProcessID is finished
    	$fLines = StringSplit($fCurLine,@CRLF,2) ;~ Splitting the result which can contain several lines
    	For $fLine In $fLines ;~ Treating each line individually
    		$fLine = StringStripWS(StringStripCR($fLine),3) ;~ Cleaning up the current string
    		If $fLine<>"" And StringRegExp($fLine,"\[\s*\d+%\s*\]",0) Then ;~ I select only the lines containing a %
    			$fPercentage = StringRegExpReplace($fLine,"^.*\[\s*(\d+)%\s*\].*$","$1") ;~ Get the percentage with a regular expression
    			ProgressSet(Int($fPercentage),$fLine) ;~ Finally apply the percentage to the progress bar and the text
    		EndIf
    	Next
    Wend
    ProgressOff()
    Shutdown(2)
    EndFunc
    
    findRecoveryImage()
    findDestination()
    createMenu()


    Thursday, August 16, 2012 4:14 PM