Saturday, November 10, 2012

Integrating DaRT 8 with MDT 2012

The second thing I wanted to do when Microsoft released MDOP 2012 (the first being to start working with App-V 5), was start working with DaRT again.  Since I'd already begun building a Windows 8 Gold Image for deployment with SCCM 2007, I wanted to see if I could simply use DaRT 8 with MDT 2012.

There are really two ways of integration DaRT with MDT 2012.  The first being to make it part of the MDT Boot Disk generated from your Deployment Share and the second to actually inject DaRT into a Deployment of Windows 8.

MDT Boot Disk Integration

This is, fortunately, very easy to do.  Once you've installed DaRT 8 (only on a Windows 8 machine, of course!), locate the install directory and the Toolsx64.cab and Toolsx86.cab files.



On your MDT Deployment Share, there is a subfolder called 'Tools'.  Under it exists 'x64' and 'x86' folders. Copy the respective CAB file into the appropriate folder.  Close and re-open the Deployment Workbench so that it can find the files on startup and set the appropriate flags.

Go to the Properties on the Deployment Share and on the 'Windows PE' tab, 'Features' sub-tab, scroll to the bottom of the list and you should now see DaRT 8 as a selectable option:


Update your Deployment Share and boot a new machine (you are using Hyper-V and VMs for testing, right?) from the ISO and you should see the following:


Deploy DaRT with Windows 8

In order to do this, you'll need to have already created a DaRT 8 image with your selected Tools, WinPE options, Debuggers, Drivers, WinDefender data, etc.  We only need the generated .WIM file, we don't care about the ISO or re-usable PowerShell script for our purposes here.

Note:  The 'Format and Partition Disk' task should be the default.  Meaning that Disk number set to 0, type is MBR, 'Create extra Active partition' is checked (this is critical) and a single NTFS Volume for the OSDisk.

First, let's create the two text files we'll use for scripting DiskPart calls:

RE_Show.txt
Select Disk 0
Detail Disk
Select Partition 1
Assign Letter =S
Detail Disk
Exit


RE_Hide.txt
Select Disk 0
Detail Disk
Select Partition 1
Remove
Detail Disk
Exit


Alright, now we have all the pieces we need to make this work. Let's hit the steps:
  1. Create new folder under your Deployment Share named 'DaRT'.
  2. Copy your DaRT 8 .WIM to %DeployRoot%\DaRT and rename it something to let you know which OS + Bit Level it's for (I named mine DaRT_W8_x64.wim).
  3. Place 'RE_Show.txt' and 'RE_Hide.txt' into the 'DaRT' folder.
  4. Edit your Task Sequence and a group named 'Deploy DaRT' in the 'State Restore' area.  I put mine under 'Custom Tasks' right before my application install groups.
  5. Create the following tasks under 'Deploy DaRT':
    1. Task: Assign Drive Letter to WinRE | Command: DiskPart.exe /s %DeployRoot%\DaRT\RE_Show.txt
    2. Task: Create Folder on WinPE Partition | Command: cmd /c md S:\Recovery\WindowsRE
    3. Task: Copy DaRT Image to WinPE Partition | Command: cmd /c copy %DeployRoot%\DaRT\DaRT_W8_x64.wim S:\Recovery\WindowsRE\WinRE.wim (use your own file name and note that the target name is always WinRE.wim).
    4. Task: Set DaRT as WinRE Image | Command: REAgentC.exe /setreimage /path S:\Recovery\WindowsRE\ | Start in: C:\Windows\System32
    5. Task: Enable DaRT as WinRE | Command: REAgentC.exe /enable | Start in: C:\Windows\System32
    6. Task: Remove Drive Letter from WinPE Partition | Command: DiskPart.exe /s %DeployRoot%\DaRT\RE_Hide.txt
Assuming everything goes well, your Imaged device now has DaRT 8 in the Windows RE Recovery Partition and Windows 8 installed.  Please note that doing this in MDT for a Gold Image and then capturing a WIM will not work.  The ZTIBackup script creates a .WIM file out of the partition, not of the entire disk, so all this work would be lost.

As a last note, Windows 8 boots really fast.  I mean really fast compared to Windows 7.  On a physical machine, I normally can't hit F8 fast enough to trigger the Boot Menu.  One site I read estimated you have 200ms to hit F8 before it's too late.  I'm a fast typer, but not that fast.  The trick I learned, and this is especially useful with Virtual Machines on Hyper-V, is this command from the running OS:

REAgentC.exe /boottore

This basically tells the Boot Commander to launch the Boot Menu and WinRE on the next boot-up.  Much easier for troubleshooting instead of pounding the keys hoping you are 200ms fast.  I believe holding Shift while clicking on Restart will also have the same effect... but I prefer the command-line option. : )

- DCtheGeek

3 comments:

  1. With the addition of REAgentC.exe /disable right before setreimage line this also works for windows 7 images. THanks!!!!

    ReplyDelete

  2. http://imageshack.us/photo/my-images/211/detailsz.png/

    Hello,

    I’m so confused, I have the problem with the drivers %make% %model%
    I’ve tried alot of solution and nothing happen.. still not going right.

    So I work with MDT 2012 That installed with ADK plus WDS on Server2012.
    Everything work perfect thanks to you Johan videos. but only the drivers i have to figureout.
    I Created Folders for My Own Computer I check with command prompt i wrote wmic computersystem get model & also manufacturer.

    So i get to the MDT and i create folder called
    Windows 7 x64
    Inside the Windows 7 x64 i create folder for the %Make% called – Gigabyte Technology Co., Ltd.
    And Under Gigabyte Technology Co., Ltd. I’ve create folder for %Model% called G41M-ES2L
    After that i go to the Task Sequence and Create “Set Sequence Variable” and I put In the line
    Task Sequence Variable: DriverGroup001
    In the Value Line: Windows 7 x64/%make%/%model/

    After that I go to the Injecting Driver and i changed to “NOTHING”

    And i Update the MDT 2012 SHARE And Boot again and nothing smell like the driver suppose to work, and keeping to the [ 1% Applying Settings installing windows ] with out installing the driver.
    So I check another solution to delete all I’ve done, and create another option.

    So only i decided to change is to delete the Set Task Sequence

    and to go Gather local only and to change it to gather only with data prosess and i put in the line

    CustomSettings.ini.

    And in the CustomSettings.ini I set command : DriverGroup001=Windows 7 x64/%make%/model%
    After that its still going to no ware.

    And I saw the Videos and search in google and no luck please help to find a solution

    Thanks alot

    http://imageshack.us/photo/my-images/211/detailsz.png/

    ReplyDelete
  3. I've included one very important point below that will allow this to work on Windows 8.1. It is a MUST to disable the Recovery Environment Agent BEFORE attempting to create the directory. Also, since DaRT 8.1, when configured to use all tools, is over 400 MB, I found it necessary to modify the ZTIDiskpart.vbs by changing WINRE_DRIVE_SIZE from 300 to 768.


    Task: Assign Drive Letter to WinRE | Command: DiskPart.exe /s %DeployRoot%\DaRT\RE_Show.txt
    Task: Disable REAgent | Command: cmd /c reagentc.exe /disable
    Task: Create Folder on WinPE Partition | Command: cmd /c md S:\Recovery\WindowsRE
    Task: Copy DaRT Image to WinPE Partition | Command: cmd /c copy %DeployRoot%\DaRT\DaRT_W8_x64.wim S:\Recovery\WindowsRE\WinRE.wim (use your own file name and note that the target name is always WinRE.wim).
    Task: Set DaRT as WinRE Image | Command: REAgentC.exe /setreimage /path S:\Recovery\WindowsRE\ | Start in: C:\Windows\System32
    Task: Enable DaRT as WinRE | Command: REAgentC.exe /enable | Start in: C:\Windows\System32
    Task: Remove Drive Letter from WinPE Partition | Command: DiskPart.exe /s %DeployRoot%\DaRT\RE_Hide.txt

    ReplyDelete