Quantcast
Channel: GARYTOWN ConfigMgr Blog
Viewing all articles
Browse latest Browse all 206

Integrate DaRT 10 Tools into your Recovery Partition during OSD

$
0
0

 

Requirements:

  1. Windows 10 ADK (Build 10586) – Download HERE
  2. Windows 10 ADK Hotfix to fix issue in ADK– Download HERE (We’ll get to this later)
  3. DaRT Recovery Image Installed –> Part of MDOP
  4. Windows 10 Media (Build 10586) Mounted

Setup:

ADK 10
image

DaRT
image

 

Launch the MS DaRT Recovery Image Wizard – If you see this error, it’s because of your Powershell group policy, to get around this, open elevated command prompt and do this: 
Reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\Powershell /v ExecutionPolicy /f
– Now try again
http://garytown.com/wp-content/uploads/2016/03/image-11.png

Choose 64-bit Dart Image – I’ve mounted the Windows 10 ISO to the D: drive
image

You can leave the tools to default
image

Check the box “Allow…” and let it default to 3388
image

Advanced Options, add any Storage & NIC drivers you’ll need & any WinPE addons
image image

Create Image: Select Create WIM, set the path to c:\cabs
image

– Note, if you want, at this step, you can check the box “Edit image” and then after it a short period, you’ll get the opportunity to add files.  I did this to add cmtrace and some other tools into the image

Now wait for a few minutes while it is generated
image

 

 

 

Adding HotFix to boot.wim (Only if you’re using Windows 10 1511 build 10586)

Extract the HotFix to c:\Cabs (I’m using 7zip)
It will create 2 schema files.

image

Also create the folder mount (C:\Cabs\Mount)

Make sure your boot.wim file is save to C:\Cabs\DaRT10\x64\boot.wim, you’ll then need to run these commands: ( original documentation here: https://support.microsoft.com/en-us/kb/3143760), this is modified based on where I’ve saved the files in my example.
Run from elevated “Deployment and Imaging Tools Environment”
image

  1. dism /mount-wim /wimfile:C:\Cabs\DaRT10\x64\boot.wim /index:1 /mountdir:C:\Cabs\mount
    image
  2. icacls C:\Cabs\mount\Windows\System32\schema.dat /save “%temp%\AclFile”
    image
  3. takeown /F C:\Cabs\mount\Windows\System32\schema.dat /A
    image
  4. icacls C:\Cabs\mount\Windows\System32\schema.dat /grant BUILTIN\Administrators:(F)
    image
  5. xcopy “C:\Cabs\schema-x64.dat” C:\Cabs\mount\Windows\System32\schema.dat /Y
    image
  6. icacls C:\Cabs\mount\Windows\System32\schema.dat /setowner “NT SERVICE\TrustedInstaller”
    image
  7. icacls C:\Cabs\mount\Windows\System32\ /restore “%temp%\AclFile”
    image
  8. dism /unmount-wim /mountdir:C:\Cabs\mount /Commit
    image

As you can see, Before:
image

After:
image

 

Ok, now we have our boot.wim file, it’s time to get it into the OSD process.

In the Standard ConfigMgr MDT Task Sequence, go to the Format and Partition Disk (UEFI)

Change the Windows RE Tools name to WinRE and change the size from 300 to 900
image

Create a Package with your boot.wim file and three batch files: (Download here)

SetDriveLetterLabel.cmd (This will take the Partition Labeled WinRE and assign letter R)
——-

REM ======start batch script=======
@echo off
setlocal ENABLEDELAYEDEXPANSION
:: Full path to diskpart.exe. Defaults are:
:: Windows 2000: “C:\Program Files\Resource Kit\diskpart.exe”
:: 2003/XP: “C:\windows\system32\diskpart.exe”
set dp=c:\windows\system32\diskpart.exe

:: Volume label
set label=WinRE

:: Temporary command file for diskpart.exe
set dps=”%TEMP%\dp.txt”

echo list volume>%dps%
echo exit>>%dps%
set label_short=%LABEL:~0,11%
if exist %dp% (
for /f “delims=” %%i in (‘%dp% /s %dps%’) do (
set string=%%i
if not “!string:%label_short%=!”==”!string!” (
set volnum=!string:~9,3!
set volnum=!volnum: =!
)
)
if not “!volnum!”==”” (
echo Volume Label: %label%
echo Volume Number: !volnum!
echo select volume !volnum! >>%TEMP%\assignr.txt
echo assign letter=R >>%TEMP%\assignr.txt
%dp% /s %TEMP%\assignr.txt
) else (
echo Cannot find volume with label %label%
)
) else (
echo Cannot find %dp%&goto :EOF
)
REM =======end batch script========

 

——-

RemoveDriveLetterLabel.cmd (This will remove the drive Letters D/E/R).  I was having some computers add a D or E drive based on other factors, so I just added it to this script to remove those letters too.
———
 

REM ======start batch script=======
@echo off
setlocal ENABLEDELAYEDEXPANSION
:: Full path to diskpart.exe. Defaults are:
:: Windows 2000: “C:\Program Files\Resource Kit\diskpart.exe”
:: 2003/XP: “C:\windows\system32\diskpart.exe”
set dp=c:\windows\system32\diskpart.exe

:: Volume label
set label=WinRE

:: Temporary command file for diskpart.exe
set dps=”%TEMP%\dp.txt”

echo list volume>%dps%
echo exit>>%dps%
set label_short=%LABEL:~0,11%
if exist %dp% (
for /f “delims=” %%i in (‘%dp% /s %dps%’) do (
set string=%%i
if not “!string:%label_short%=!”==”!string!” (
set volnum=!string:~9,3!
set volnum=!volnum: =!
)
)
if not “!volnum!”==”” (
echo Volume Label: %label%
echo Volume Number: !volnum!
echo select volume !volnum! >>%TEMP%\remover.txt
echo remove letter=r >>%TEMP%\remover.txt

echo select volume !volnum! >>%TEMP%\removed.txt
echo remove letter=d >>%TEMP%\removed.txt

echo select volume !volnum! >>%TEMP%\removee.txt
echo remove letter=e >>%TEMP%\removee.txt

%dp% /s %TEMP%\remover.txt
%dp% /s %TEMP%\removed.txt
%dp% /s %TEMP%\removee.txt
) else (
echo Cannot find volume with label %label%
)
) else (
echo Cannot find %dp%&goto :EOF
)
REM =======end batch script========

——-

 

InstallDartUEFI.cmd (This deletes the old Windows Recovery WIM, creates the new folder structure and copies the boot.wim into place and assigns it as the recovery wim – It calls the script above to remove the drive letter when it’s done.)
——–

REM SetDriveLetterLabel.cmd – Now doing in Previous Step, sets WinRE partition to Letter R

REM Make Directory where DaRT Recovery WIM will be placed
mkdir R:\Recovery\WinRE

REM Copy DaRT Recovery WIM into Recovery Partition
copy boot.wim R:\Recovery\WinRE\winre.wim

REM Set Windows to use the new DaRT Recovery WIM
C:\Windows\System32\ReAgentc.exe /disable
C:\Windows\System32\ReAgentc.exe /setreimage /path R:\Recovery\WinRE /target C:\Windows
C:\Windows\System32\ReAgentc.exe /enable

REM Remove the Drive Letter for the Recovery Partition – Removes Letter R and D/E if exist.
RemoveDriveLetterLabel.cmd

——-

Package Contents:
image

 

In the TS:
In the State Restore Group, add two Steps

  1. Install WinRE – Dart10 – UEFI – Step1 (cmd /c SetDriveLetterLabel.cmd)
    image
  2. Install WinRE – Dart10 – UEFI – Step2 (cmd /c InstallDartUEFI.cmd)
    image

After OSD, you can go into your recovery options..  and choose Advanced Startup  – Once at the Option Screen, pick Troubleshoot –> Advanced –> Command Prompt
image image image

It will now reboot into the Windows Recovery Partition.
You’ll see a prompt for “Would you like to initialize network connectivity..”, click yes

It will now prompt you for your bitlocker Key, if bitlocker is enabled.  Enter it and click continue
The Command Prompt will Open, just go ahead and close it.

You will now see options, choose Troubleshoot –> Microsoft Diagnostics and Recovery Toolset will be an option.

Now that you launched DaRT, you’ll have several options available to you, including Remote Connection, which is what I’m using to connect in to grab the screen capture.
image

 

Several hand tools built in like LockSmith, to recover Admin Passwords.  This is handy if you have LAPS implemented, and the machine is deleted from the domain so you no longer have access to the Admin password.
image

File Restore in action:
image

 

And if you like, you can even add a web browser to your Image, because hey, why not!  Pale Moon 64bit seems to work alright. Smile  Just Extract the Program to a folder and copy that folder into your image.  Then use Explorer to browse to it.

image

So there you have it, integrating DaRT 10 into your Windows 10 10586 Deployments

I’ve tested this on Dell Latitude E6540, Precision 7510 & MS Surface Pro.  I’ve done this in the Past with DaRT 8 on an entire range of Dell devices without any issues.  But I’ve only started to implement this with DaRT10.


Viewing all articles
Browse latest Browse all 206

Trending Articles