Capture User Files and Settings Offline (WinPE) or Online (FullOS) with ConfigMgr 2007

They always say never change a winning team, but sometimes its just cowl to see if its possible to be even better. I had the same with a previous post in which I already showed how to do a Hard-Link migration, when started from WinPE (and FullOS). The biggest part of that example is still the same, but some pieces changed to get a better result.

In this post I will go step-by-step (again) to mention the changes that I made to make it even better. At the end of both parts of this post I will shine a light on the changes that I made.

Part 1: Capture User Files and Settings

HardlinkOnOffTSFor creating a Task Sequence, that does an Online or Offline Capture, my way, a few variables and locations need to be created. After that a command line has to be run to do the actual Capture. Under here I will sum up the steps I take to do an Online and Offline Capture (also see the first red rectangle in the picture):

  • Set Started in WinPE – Set Task Sequence Variable
    This step sets the Task Sequence Variable TSStartedInWinPE to YES. This Task Sequence Variable only gets set when _SMSTSInWinPE is TRUE.
  • Set Architecture – Set Task Sequence Variable
    This step sets the Task Sequence Variable Architecture to amd64. This variable will be used for selecting the USMT 4.0 version for (in my case) 64-bit systems.
  • Set Windows Partition – Set Task Sequence Variable
    This step sets the Task Sequence Variable WindowsPartition to C:. This variable will be used for selecting the Windows partition.
  • Set State Store Location – Set Task Sequence Variable
    This step sets the Task Sequence Variable OSDStateStorePath to %WindowsPartition%\StateStore. This variable will be used for creating and selecting the User State Location.
  • Create State Store Location – Run Command Line
    This step creates the directory %WindowsPartition%\StateStore by running the Command line: cmd /c MKDIR %OSDStateStorePath%.
  • Cache USMT Files and Scripts – Run Command Line
    This step caches the USMT Files and Scripts from the USMT Package to the directory %OSDStateStorePath%\USMTFiles\ by running the Command line: xcopy * %OSDStateStorePath%\USMTFiles\ /herciy
  • Capture User Files and Settings – WinPE – Run Command Line
    This step does the actual Offline Capture of the User Files and Settings by running the Command line RunScanState_WinPE.BAT %OSDStateStorePath% %WindowsPartition% %Architecture% %_SMSTSLogPath% which has to start in the directory %OSDStateStorePath%\USMTFiles\. This step only runs when the machine is started from WinPE. This is done by checking if the Task Sequence Variable TSStartedInWinPE is set to YES.
  • Capture User Files and Settings – FullOS – Run Command Line
    This step does the actual Online Capture of the User Files and Settings by running the Command line RunScanState_FullOS.BAT %OSDStateStorePath% %WindowsPartition% %Architecture% %_SMSTSLogPath% which has to start in the directory %OSDStateStorePath%\USMTFiles\. This step only runs when the machine is started from FullOS. This is done by checking if the Task Sequence Variable TSStartedInWinPE is not set to YES. 

These are all the steps I need, to do an Online or Offline Capture with Hard-Links. Now let’s take a closer look at the batch-files which do the most of the work:

RunScanState_FullOS.BAT

REM ======================================================
REM ARGUMENT -1- OSDStateStorePath     = %1
REM ARGUMENT -2- WindowsPartition    = %2
REM ARGUMENT -3- Architecture        = %3
REM ARGUMENT -4- LogDirectory        = %4
REM ======================================================

SET USMT_WORKING_DIR=%1\USMTFiles\%3

REM ======================================================
REM RUN Scanstate
REM ======================================================

"%1\USMTFiles\%3\Scanstate.exe" "%1" /o /hardlink /nocompress /i:%1\USMTFiles\%3\MigUser.xml /i:%1\USMTFiles\%3\MigApp.xml /localonly /l:%4\ScanState.log /v:5 /progress:%4\ScanStateProgress.log /c /efs:hardlink

REM ======================================================
REM EXIT Errorlevel
REM ======================================================

EXIT /b %errorlevel%

RunScanState_WinPE.BAT

REM ======================================================
REM ARGUMENT -1- OSDStateStorePath     = %1
REM ARGUMENT -2- WindowsPartition    = %2
REM ARGUMENT -3- Architecture        = %3
REM ARGUMENT -4- LogDirectory        = %4
REM ======================================================

SET USMT_WORKING_DIR=%1\USMTFiles\%3

REM ======================================================
REM RUN Scanstate
REM ======================================================

"%1\USMTFiles\%3\Scanstate.exe" "%1" /o /hardlink /nocompress /i:%1\USMTFiles\%3\MigUser.xml /i:%1\USMTFiles\%3\MigApp.xml /offlinewindir:%2\Windows /localonly /l:%4\Scanstate.log /v:5 /progress:%4\Scanstateprogress.log /c /efs:hardlink

REM ======================================================
REM EXIT Errorlevel
REM ======================================================

EXIT /b %errorlevel%

The changes that I made in Part 1: Capture User Files and Settings are the following two:

  1. I use now a batch-file for both, and Online and Offline Capture.
    Why? Just because it gives me more flexibility and because I can get rid of a few “double” steps. For example, now I can use the same Store Location (variable) for both Captures Types.
  2. I use now a different location for the logfiles.
    Why? Just because it gives me an easy possibility to save the log until the end of the Task Sequence.

Part 2: Restore User Files and Settings

After the User Files and Settings have been captured, they need to be restored again to the new OS. This is the same for an Online and Offline Capture. Under here I will sum up the steps that I use to restore the Files and Settings:

  • Restore User Files and Settings – Run Command Line
    This step does the actual Restore of the User Files and Settings by running the Command line RunLoadState.BAT %OSDStateStorePath% %WindowsPartition% %Architecture% %_SMSTSLogPath% which has to start in the directory %OSDStateStorePath%\USMTFiles\..
  • Cleanup State Store Location – Run Command Line 
    This step cleans up the State Store Location by running the command line RunUSMTutils.BAT %OSDStateStorePath% %Architecture%
  • Restart in FullOS – Restart Computer (see the second red rectangle in the picture)
    This step will restart the computer, but only when _SMSTSLastActionRetCode is equal to 2.

These are all the steps I need, to do a Restore with Hard-Links. Now let’s take a look at the batch-files which do most of the work here:

RunLoadState.BAT

REM ======================================================
REM ARGUMENT -1- OSDStateStorePath     = %1
REM ARGUMENT -2- WindowsPartition    = %2
REM ARGUMENT -3- Architecture        = %3
REM ARGUMENT -4- LogDirectory        = %4
REM ======================================================

SET USMT_WORKING_DIR=%1\USMTFiles\%3

REM ======================================================
REM RUN LoadState
REM ======================================================

"%1\USMTFiles\%3\Loadstate.exe" "%1" /hardlink /nocompress /lac /i:%1\USMTFiles\%3\MigUser.xml /i:%1\USMTFiles\%3\MigApp.xml /l:%4\LoadState.log /v:5 /progress:%4\LoadStateProgress.log /c

REM ======================================================
REM EXIT Errorlevel
REM ======================================================

EXIT /b %errorlevel%

RunUSMTutils.BAT

REM ====================================================== 
REM VARIABLE -1- OSDStateStorePath = %1
REM VARIABLE -2- Architecture = %2
REM ======================================================

REM ======================================================
REM RUN USMTUtils
REM ======================================================

echo y| "%~dp0%2\usmtutils.exe" /rd "%1"

REM ======================================================
REM EXIT Errorlevel
REM ======================================================

EXIT /b %errorlevel%

The changes that I made in Part 2: Restore User Files and Settings are the following two:

  1. I use now also batch-file for the Restore.
    Why? Just because it gives me more flexibility and because I can get rid of a “double” step (setting the Hardlink options).
  2. I use now an optional restart of the computer.
    Why? Because I noticed that sometimes USMTUtils ends with code 2, which means that it needs a restart to get rid of the last files.

Note: The RunScanState_FullOS.BAT, RunScanState_WinPE.BAT, RunLoadState.BATand the RunUSMTutils.BAT have to be placed inside the USMT Package at the same level as the amd64- and the x86-folder.

More information about the Scanstate Syntax:
http://technet.microsoft.com/en-us/library/dd560781(WS.10).aspx
More information about the LoadState Syntax:
http://technet.microsoft.com/en-us/library/dd560804(WS.10).aspx
More information about the USMTUtils Syntax: http://technet.microsoft.com/en-us/library/dd560799(WS.10).aspx

How to install a ConfigMgr Client on a WORKGROUP computer, when the ConfigMgr Site is in Native Mode.

NativeModeWorkgroup To install a ConfigMgr Client on a WORKGROUP computer is always a nice battle, when the ConfigMgr Site is in Native Mode. I think I am not the only one who didn’t work that much with certificates before ConfigMgr. So to make the basics of this process for everyone a bit easier I wrote down these seven steps for implementing the correct certificates and installing the ConfigMgr Client on a WORKGROUP client. These same steps can also be used for separate forests.

Step 1. Export the Root Certificate for use on the WORKGROUP computer

  1. Logon to the Certification Authority server and create a folder to contain your certificate files (eg C:\Certificates).
  2. Open a command prompt and go to the just created folder.
  3. Use the following command to export the Root Certificate: certutil -ca.cert RootCertificate.cer

 

Step 2. Create a Certificate Template for the WORKGROUP computer

  1. Open the Certification Authority Console, right-click Certificate Templates, and click Manage to load the Certificates Templates console.
  2. Select Windows Server 2003 Enterprise and click Ok.
  3. Right-click the Workstation Authentication template and click Duplicate Template.
  4. In the Properties of New Template dialog box, type the name for Template display name. As my normal Client Certificate Template is named ConfigMgr Client Certificate, I will name this one ConfigMgr Client Certificate for Export.
  5. Click the Request Handling tab and select Allow private key to be exported.
  6. Click the Subject Name tab, select Supply in the request.  This allows you to supply each FQDN of the client in the separate WORKGROUP at the time you request the certificate.
  7. Click OK to close the Properties of New Template and close the Certificates Template Console.
  8. In the Certification Authority Console, right-click Certificate Templates, click New, click Certificate Template to Issue, select the certificate template name you just created (eg ConfigMgr Client Certificate for Export), and then click OK.

 

Step 3. Request and Install the Client Certificate for the WORKGROUP computer

  1. Open a text editor and copy and paste the following text into the file (replace< FQDN> with the fully qualified domain name of the server that has to use this certificate):

    [NewRequest]
    Subject = "CN=<FQDN>"
    MachineKeySet = True
    Exportable = TRUE
    KeyLength = 2048
    [RequestAttributes]
    CertificateTemplate = ConfigMgrClientCertificateforExport

  2. Save the file as ConfigMgrClientCertificate.inf in the folder created in Step 1.
  3. Open a command prompt and go to the same folder as the saved file.
  4. Use the following command to create a certificate request: certreq –new ConfigMgrClientCertificate.inf ConfigMgrClientCertificate.req
  5. Use the following command to submit the certificate request: certreq –submit ConfigMgrClientCertificate.req ConfigMgrClientCertificate.cer
  6. In the Select Certification Authority dialog box, select the CA, and then click OK.
  7. Use the following command to accept the requested certificate: certreq –accept ConfigMgrClientCertificate.cer

 

Step 4. Export the Client Certificate for the WORKGROUP computer

  1. Open the Certificates Console for the local computer, right-click the certificate that is issued to <FQDN>, click All Tasks, and then click Export to launch the Certificate Export Wizard.
  2. On the Welcome page, click Next.
  3. On the Export Private Key page select Yes, export the private key and click Next.
  4. On the Export File Format page confirm that Personal Information Exchange – PKCS #12 (.PFX) is selected and click Next.
  5. On the Password page specify a password and click Next.
  6. On the File to Export page specify the path and name of the file and click Next.
  7. On the Summary page click Finish and click OK to close the confirmation popup.

 

Step 5. Import the Root Certificate in the WORKGROUP computer

  1. On the computer in the WORKGROUP, open the Certificates Console for the local computer and navigate to Trusted Root Certification Authorities\Certificates.
  2. Right-click Certificates select All Tasks and click Import to load the Certificate Import Wizard.
  3. On the Welcome page click Next.
  4. On the File to Import page click Browse and select the root certificate file that you created. After that click Open and then click Next.
  5. On the Certificate Store page click Next.
  6. Click Finish to close the wizard and click OK to close the confirmation popup.

 

Step 6. Import the Client Certificate in the WORKGROUP computer

  1. Open the Certificates Console for the local computer and this time navigate to Personal\Certificates.
  2. Right-click Certificates select All Tasks and click Import to load the Certificate Import Wizard.
  3. On the Welcome page click Next.
  4. On the File to Import page click Browse and select the exported certificate file that you created. Next click Open and then click Next.
  5. On the Password page type the password that you specified earlier and then click Next.
  6. On the Certificate Store page click Next.
  7. Click Finish to close the wizard and click OK to close the confirmation popup.

 

To confirm that the certificates got imported well, navigate to Personal\Certificates and select the certificate that is issued to <FQDN>. Double-click the certificate and click the Certificate Path tab, this checks that the certificate successfully chains to the issuing root CA certificate.  You should see the certificate and the root CA certificate, with the Certificate status displaying This certificate is OK.  Click OK to close the certificate properties.

Step 7. Install the ConfigMgr Client on the WORKGROUP computer

  1. Open a command prompt and go to the location of the ccmsetup.exe.
  2. Use the following, or similar, command to install the ConfigMgr Client: ccmsetup.exe  /Native:FALLBACK SMSSITECODE=<SiteCode> SMSSLP=<SLP>

 

Reminder: Don’t forget to add a Boundary to your ConfigMgr Site that includes the WORKGROUP computer.

User Driven Installation with ConfigMgr 2007 and MDT 2010 Update 1

UDI_WizardA few months ago I wrote a post about User Driven OS Deployment "Modena". By then it wasn’t sure if it was going to be released to the big public. Well I can tell now (after finally looking around in the the MDT 2010 Update 1 Beta) that it is going to be released, as it is a part of the MDT 2010 Update 1 (Beta).

Of course the scripts are now made to fit with the other MDT scripts, but the look-and-feel is the same (see picture).

This means that there is now an easy way coming for everyone to get their users “involved” in an OS Deployment. The only requirements are to have ConfigMgr 2007 and MDT 2010 Update 1 (Beta) installed and to have the ConfigMgr Integration configured.

How to create a User Driven Installation Task SequenceUDI_TaskSequence

  1. Open the Configuration Manager console and browse to System Center Configuration Manager > Site Database > Computer Management > Operating System Deployement > Task Sequences.
  2. Select Create Microsoft Deployment Task Sequence in the Actions pane.
  3. Select User Driven Installation Task Sequence and click Next (see picture). After this run, through the wizard an its done!

 

To keep a short story short, take a look at Microsoft Connect to get MDT 2010 Update 1 (Beta): 
>> https://connect.microsoft.com/site14 <<

The first Beta of ConfigMgr vNext has been released!

Although there is still a ConfigMgr 2007 R3 in the making, the first beta of ConfigMgr vNext has already been released.

Take a look at the System Center Team Blog for more inside information: http://blogs.technet.com/b/systemcenter/archive/2010/05/24/the-next-generation-of-client-management.aspx
Take a look at Microsoft Connect for the download: https://connect.microsoft.com/ConfigurationManagervnext/Downloads

ConfigMgr 2007 R3 is making a step in Green IT with Power Management

This post is not meant as a guide for installing or configuring the R3 feature pack and/ or Power Management. I will just show, in a few screenshots and a bit explanation, what the possibilities are regarding the Power Management feature in ConfigMgr 2007 R3.

PwrMngmntAgentAs we all already knew, one of the coolest new features of ConfigMgr 2007 R3 would be Power Management. Another step in the direction of Green IT.  The Power Management feature provides a new Client Agent which enables you to apply power settings to client computers in the organization and monitor the power usage of these computers.

How to Enable the Power Management Client Agent

  1. Open the Configuration Manager console and browse to System Center Configuration Manager > Site Database > Site Management > <YourSiteName> > Site Settings > Client Agents.
  2. Select the Power Management Client Agent and click in the Actions pane Properties (or right-click the Power Management Client Agent and click Properties) to open the Power Management Client Agent Properties.
  3. Select Enable power management on clients and click Ok.

After a policy refresh the Power Management Client Agent will be enabled on the client.

How to Enable Power Management settings PwrMngmntSettings

  1. Open the Configuration Manager console and browse to System Center Configuration Manager > Site Database > Computer Management > Collections.
  2. Select <YourCollectionName>, click in the Actions pane Modify Collection Settings (or right-click <YourCollectionName> and click Modify Collection Settings) and select the Power Management tab to open the Power Management Settings.
  3. Select Enable power management settings, specify the power management settings (like different power plans and wake up time) and click Ok.

Now you have this possibility to enable Power Management settings on a per collection base. These settings work in a same way as setting Maintenance Windows on a per collection base.

How to view the Power Settings/ Capabilities/ Costs and Consumption

During the installation of R3 a new cab-file (MicrosoftReportPack) will be placed in <ConfigMgrInstallationDir>\Reports\Power Management.  PwrMngmntReportsWithout importing this cab-file you will not be able to see the Power Management reports, so don’t forget to import these handy reports! 

  1. Open the Configuration Manager console and browse to System Center Configuration Manager > Site Database > Computer Management > Reporting Services > <ServerName> > Report Folders.
  2. Select Power Management.
  3. Select the report that your want and click in the Actions pane Run (or right-click the report that want and click Run).

In these reports you can see all the information about Power Management, from capabilities till costs and from settings till consumptions.

ConfigMgr 2007 and editing the registry during a Task Sequence on a 64-bit OS

Disable64bitTSOf course you know, deep down, that the ConfigMgr 2007 Client is 32-bit and that it will react a bit different on a 64-bit OS. The reason for this is of course the emulation layer, also know as Windows 32-bit On Windows 64-bit (WOW64), that enables a 32-bit application to run seamlessly on a 64-bit OS. 

As the ConfigMgr 2007 (RTM, SP1, SP2) Client is only available in a 32-bit version, you may run into some bumps on a 64-bit Operation System. One of these bumps is editing a registry key in HKEY_LOCAL_MACHINE\Software, because, for the ConfigMgr 2007 Client, this will get redirected to HKEY_LOCAL_MACHINE\Software\WOW6432Node.

Luckily there is an easy solution for this in a Task Sequence of ConfigMgr 2007. Just create a Task Sequence, add a Run Command Line –step and select Disable 64-bit file system redirection. This will makes sure that the use of the WOW64 file redirector will be disabled. 

Example UserName_on_ComputerName
An often used registry edit is to rename the Computer (on XP this is My Computer) to “Username on Computername”. To do this you need to edit the  HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString –key. Without disabling the 64-bit file system redirection, the ConfigMgr 2007 Client will only change the key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString. This will not make the change show in the menu or the explorer.

More information about the Run Command Line –step: http://technet.microsoft.com/en-us/library/bb632992.aspx
More information about WOW64, Registry (and File System) Redirection and Reflection: http://www.microsoft.com/whdc/system/platform/64bit/WoW64_bestprac.mspx

Configuration Manager 2007 R3 Beta has been released!

I would like to make a short note of the following announcement on the ConfigMgr Connect Site (https://connect.microsoft.com/site16)

System Center Configuration Manager 2007 R3 Beta has been released!

As a member of the Configuration Manager 2007 R3 Open Beta program you can download at this Connection via the downloads tab.

Feedback can be provided using the Feedback tool and also available is discussions via the Newsgroups where you can post comments and ask questions.

Thank you.

ConfigMgr Customer team

How to back up your ConfigMgr 2007 Site

This post is just meant to freshen up everyone’s memory, because I still see (and get) stories (and questions)about backing up a ConfigMgr 2007 Site (and then especially about Secondary Sites). Let’s start with the most important part, the only supported way to restore your site is to use the Site Repair Wizard. This wizard needs a backup that is created with the standard Backup ConfigMgr Site Server maintenance task.

How to back up a Primary Site BackupConfigMgrSiteServerProp

  1. Open the Configuration Manager console and browse to System Center Configuration Manager > Site Database > Site Management > <YourSiteName> > Site Settings > Site Maintenance > Tasks.
  2. Select the Backup ConfigMgr Site Server task and click in the Actions pane Properties (or right-click the Backup ConfigMgr Site Server task and click Properties) to open the Backup ConfigMgr Site Server Properties.
  3. Select Enable this task, specify the backup task properties (like backup destination, day and time) and click Ok.

How to back up a Secondary Site

As you might know there is also a task to create a backup of a Secondary Site. Just keep in mind that it has no use to enable it, because you cannot restore this backup by using the Site Repair Wizard. The only supported way to recreate your Secondary Site is to reinstall your Secondary Site! After reinstalling the Secondary Site, the Primary Site will replicate the site data to it.

More information about Tasks for Backing Up a Site: http://technet.microsoft.com/en-us/library/bb680862.aspx

Using USMTUtils.exe during a Task Sequence with ConfigMgr 2007

As I had a lot of questions about the use of USMTUtils, I decided to devote a new post to this. In my previous post I used USMTUtils to clean up the hard-link statestore location.

USMTUtils is needed to clean up a hard-link statestore, because otherwise the hard-link store cannot be deleted due to a sharing lock. The command-line provided by Technet to do this is usmtutils.exe /rd <storedirectory>. Only this is exactly where the problem starts when running a command like this during a Task Sequence, because this will make the Task Sequence “hang” on the point where it has to delete the hard-link statestore. Taking a look at the SMSTS.log, at this point, will show something similar to this:

<![LOG[Executing command line: Run command line]LOG]!><time="14:56:41.804+-60" date="03-23-2010" component="InstallSoftware" context="" type="1" thread="2904" file="commandline.cpp:805">
<![LOG[]LOG]!><time="14:56:42.148+-60" date="03-23-2010" component="InstallSoftware" context="" type="1" thread="2904" file="runcommandline.cpp:34">
<![LOG[WARNING: This command is going to delete the following list of path(s).]LOG]!><time="14:56:42.195+-60" date="03-23-2010" component="InstallSoftware" context="" type="1" thread="2904" file="runcommandline.cpp:34">
<![LOG[Please review before continuing …]LOG]!><time="14:56:42.195+-60" date="03-23-2010" component="InstallSoftware" context="" type="1" thread="2904" file="runcommandline.cpp:34">

After this I just tried running the command-line manually from a cmd in Windows and this showed the following information:

WARNING: This command is going to delete the following list of path(s).
Please review before continuing …

        C:\<storedirectory>

Are you sure you want to proceed (Y/N)?

The conclusion here is that running the command-line usmtutils.exe /rd <storedirectory> will need a confirmation. This is the point where we have to grab back to a batch-file, so we can pipeline a positive response to the question asked by the USMTUtils. This can be done by using echo y|. So the batch-file, that we need to run the USMTUtils from a Task Sequence (with ConfigMgr 2007), has to include the command-line echo y| usmtutils.exe /rd <storedirectory>.

I hope this post gives a bit more inside information of why it is needed to pipeline a confirmation with the use of USMTUTils.

Capture User Files and Settings in Offline Mode (WinPE) with ConfigMgr 2007

In a previous postI already showed how to do a Hard-Link migration, when started from FullOS. That part still exists in my Task Sequence, but it is now moved under the Group Capture User Files and Settings – FullOS. This part will now only run when the Task Sequence is started from FullOS.

In this post I will add a part to the Task Sequence that makes sure that the User State will also be captured,  HardLinkOfflineTS when the Task Sequence is started from WinPE (also called Offline Mode). The cool part is that it will also be done by/ with using Hard-Links!

Capture User Files and Settings

For creating a Task Sequence, that does an Offline Capture, my way, a few variables and locations need to be created. After that a command line has to be run to do the actual Capture. Under here I will sum up the steps I take to do an Offline Capture (also see the red rectangle in the picture):

  • Set Started in WinPE – Set Task Sequence Variable
    This step sets the Task Sequence Variable TSStartedInWinPE to YES. This Task Sequence Variable only gets set when _SMSTSInWinPE is TRUE.
  • Capture User Files and Settings – WinPE – Group
    This group Captures the User Files and Settings when the machine is started from WinPE. This is done by checking if the Task Sequence Variable TSStartedInWinPE is set to YES.
  • Set Architecture – Set Task Sequence Variable
    This step sets the Task Sequence Variable Architecture to amd64. This variable will be used for selecting the USMT 4.0 version for 64-bit systems.
  • Set Windows Partition – Set Task Sequence Variable
    This step sets the Task Sequence Variable WindowsPartition to C:. This variable will be used for selecting the Windows partition.
  • Set State Store Location – Set Task Sequence Variable
    This step sets the Task Sequence Variable OSDStateStorePath to %WindowsPartition%\StateStore. This variable will be used for creating and selecting the User State Location.
  • Create State Store Location – Run Command Line
    This step creates the directory %WindowsPartition%\StateStore by running the Command line: cmd /c MKDIR %OSDStateStorePath%.
  • Cache USMT Files and Scripts – Run Command Line
    This step caches the USMT Files and Scripts from the USMT Package to the directory %OSDStateStorePath%\USMTFiles\ by running the Command line: xcopy * %OSDStateStorePath%\USMTFiles\ /herciy
  • Capture User Files and Settings – Run Command Line
    This step does the actual Capture of the User Files and Settings by running the Command line RunScanState.BAT %OSDStateStorePath% %WindowsPartition% %Architecture% which has to start in the directory %OSDStateStorePath%\USMTFiles\.

These are all the steps I need, to do an Offline Capture with Hard-Links. Now let’s take a closer look at the batch-file which does most of the work.

REM ============================================================
REM VARIABLE -1- OSDStateStorePath = %1
REM VARIABLE -2- WindowsPartition = %2
REM VARIABLE -3- Architecture = %3
REM ============================================================

SET USMT_WORKING_DIR=%1\USMTFiles\%3

REM ============================================================
REM RUN Scanstate
REM ============================================================

“%1\USMTFiles\%3\Scanstate.exe” “%1” /o /hardlink /nocompress /i:%1\USMTFiles\%3\miguser.xml i:%1\USMTFiles\%3\migapp.xml /offilinewindir:%2\Windows\TEMP\SMSTSLog\Scanstate.log /v:5 /progress:%2\Windows\TEMP\SMSTSLog\Scanstateprogress.log /c /efs:hardlink

REM ============================================================
REM EXIT Errorlevel
REM ============================================================

EXIT /b %errorlevel%

In this batch-file I am using three variables which are being set during the Task Sequence (and explained in the batch). The Scanstate command line, that is being used, is completely based on the standard syntax. Under here I created a table in which can be seen what every part of my command line stands for.

Command What does it do…
%1\USMTFiles\%3\scanstate.exe Scanstate.exe
%1 Specifies the folder where files and settings will be saved
/o Enables the possibility to overwrite existing data in de Migration Store.
/hardlink Enables the creation of a Hard-Link Migration Store
/nocompress Disables the compression of data.
/i:%1\USMTFiles\%3\miguser.xml Specifies an .xml file that contains rules that define what user, application or system state to migrate
/i:%1\USMTFiles\%3\migapp.xml Specifies an .xml file that contains rules that define what user, application or system state to migrate
/offlinewindir:%2\windows Specifies the Offline Windows directory that the ScanState command gathers user state from
/l:%2\windows\TEMP\SMSTSLog\Scanstate.log Specifies the location and name of the ScanState log
/v:5 Enables the verbose output in the ScanState log file
/progress:%2\windows\TEMP\SMSTSLog\Scanstateprogress.log Specifies the location and name of the ScanState progress log
/c Enables the ScanState command to continue to run, even if non-fatal errors occur
/efs:hardlink Enables the migration of encrypted files by creating a Hard-Link to the EFS file instead of copying it

Restore User Files and Settings

After the User Files and Settings have been captured, they need to be restored again to the new OS. For this I use the default Restore User Files and Settings step from ConfigMgr 2007 and the variable OSDMigrateAdditionalRestoreOptions. This variable is filled with the options /nocompress /hardlink, see for this also my previous post. This default step will restore everything that is found in the State Store Location.

With the red arrow in the picture I point at another important step (which is often forgotten). This step is the Cleanup User State Location, a Run Command Line step from ConfigMgr 2007. This step cleans up the State Store Location by running the command line RunUSMTutils.BAT %OSDStateStorePath% %Architecture% from the USMT 4.0 Package.

Now let’s take a look at the batch-file which does most of the work here.

REM ============================================================
REM VARIABLE -1- OSDStateStorePath = %1
REM VARIABLE -2- Architecture = %2
REM ============================================================

REM ============================================================
REM RUN USMTUtils
REM ============================================================

echo y| “%~dp0%2\usmtutils.exe” /rd “%1”

REM ============================================================
REM EXIT Errorlevel
REM ============================================================

EXIT /b %errorlevel%

The important part in here is the echo y|, because only running umstutils.exe /rd will ask for a confirmation on the action. I have to say that I really missed this in the documentation! So just use echo y| to pipeline a positive response on the confirmation, asked by the usmtutils.

Note: The RunScanState.BAT and the RunUSMTutils.BAT have to be placed inside the USMT Package at the same level as the amd64- and the x86-folder.

More information about the Scanstate Syntax:
http://technet.microsoft.com/en-us/library/dd560781(WS.10).aspx
More information about the LoadState Syntax:
http://technet.microsoft.com/en-us/library/dd560804(WS.10).aspx
More information about the USMTUtils Syntax: http://technet.microsoft.com/en-us/library/dd560799(WS.10).aspx