Partilhar via


How to restore from the OS backup

A customer requirement for a recent pilot project was to migrate user workstations to Vista for only a few weeks; we have to restore to the previous OS at the end of the pilot.  There are other scenarios in which you'd need to restore a system using the fat WIM captured with the MDT Backup script in your deployment task sequence.  Here's a rough process to do the restore.

  1. Restart the computer to a generic WinPE 2.0 boot disk (that contains the necessary disk and network drivers).
  2. If the folder doesn't already exist, create C:\_SMSTaskSequence\StateStore.
  3. Ensure the backup WIM is in that folder.  If the deployment failed, the backup should be there already.  If the deployment succeeded, the backup WIM should be at C:\Windows\Temp\StateStore; move it to C:\_SMSTaskSequence\StateStore.  If there was insufficient space on the hard drive to store the backup (regardless of whether the deployment failed or succeeded) and you properly configured your CustomSettings.ini, the WIM will be on a network share.  Copy it to C:\_SMSTaskSequence\StateStore (I recommend using robocopy /tee to see the progress).
  4. Double- and triple-check that everything you need from the system is copied off elsewhere or under C:\_SMSTaskSequence.
  5. Run cmd /v:on /c z:\wipe.cmd wipe to delete all content from C: except the _SMSTaskSequence folder (see wipe.cmd contents below).
  6. Map a drive to the deployment share (MDT or ConfigMgr server).
  7. Run Z:\Tools\x86\imagex.exe /apply C:\_SMSTaskSequence\StateStore\backup.wim 1 c:\ to restore.
  8. Type exit to restart to the previous OS.

Depending upon how your task sequence is configured, you may need to logon as the local administrator and rejoin to the domain.

You should be able to delete C:\_SMSTaskSequence at this point.

15 February 2009: I updated the script, which properly handles spaces in folder names (e.g., Documents and Settings, Program Files)

Wipe.cmd

 @echo off
cls

REM Wipe Drive script
REM Aaron Czechowski, Microsoft Consulting Services
REM 4 December 2007

REM display help if not parameter is specified
if !%1==! goto SYNTAX

REM initialize variable for total number of root files/folders
set /a intTotal=0

REM loop through each root file/folder and increment counter if it's not C:\_SMSTaskSequence
FOR /f "delims=" %%i in ('dir c:\ /b /a') do    if not %%i==_SMSTaskSequence    set /a intTotal+=1


echo wiping drive ...
echo.

REM initialize variable for current file/folder
set /a intCount=1

REM loop through each root file/folder,
REM   if it's not C:\_SMSTaskSequence, pass the object name to the PROCESSOR section
for /f "delims=" %%i in ('dir c:\ /b /a /o:n') do    if not %%i==_SMSTaskSequence    call :PROCESSOR "%%i"

echo.
echo Processing complete.
echo.
goto :EOF


:PROCESSOR
      REM %%i variable from above "call" is interpreted here as the first parameter (%~1)
      REM %~1 expands %1 removing any surrounding quotes (")
      REM !intCount! relies upon delayed environment variable expansion to be enabled
      echo          ... deleting !intCount! of %intTotal% (%~1^)
      del "c:\%~1" /q /f /a > NUL 2>&1
      rmdir "c:\%~1" /s /q > NUL 2>&1

      set /a intCount+=1

      REM return to just after the "call" above
      goto :EOF

:SYNTAX
     echo You must supply at least one argument to run this script.
     echo Delayed environment variable expansion (/v:on) should be
     echo    enabled to correctly display the progress.
     echo.
     echo    cmd /v:on /c wipe.cmd wipe

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