Jump to content


  • 0
anyweb

using Offline Mode in Windows PE using USMT 4 via a task sequence in SCCM 2007 SP2

Question

hi all,

 

Note: This post has been reproduced in a webcast, so if you'd like to see a video of Offline Mode in WinPE then click here

 

 

 

well this feature in USMT 4 is handy, as it allows you to do a scanstate while in Windows PE in other words, not in the OS so no problems with services running or applications running meaning that you get to backup everything you want without any locked files stopping from doing so.

 

Offline mode does however have some restrictions, read this page on Technet for details of that. To get around these restrictions and to migrate wallpaper see here, to migrate your network printers see here.

 

 

Great, but how do I do Offline Mode in Windows PE using SCCM ?

 

according to Microsoft, we can use the /offlinewindir switch in USMT 4 with scanstate.

 

/offlinewindir: "path to a windows directory"

 

 

This option specifies the offline Windows directory that the ScanState command gathers user state from. The offline directory can be Windows.old when you run the ScanState command in Windows or a Windows directory when you run the ScanState command in Windows PE. This option is incompatible with the /offline option.

 

However, implementing it isn't so straigtforward as you've probably already discovered and documentation about getting it to work within SCCM is as far as I can see pretty much non-existant,

so here courtesy of windows-noob.com is one way of doing it, feel free to show us other ways.

 

The theory behind this:-

 

As the Capture User State Step in a standard task sequence can only run in Windows, we cannot use that step to do our scanstate while in Windows PE, therefore we will use some tricks to run scanstate from WinPE.

 

To do this we create two special packages, the first package contains a batch file which calls the scanstate.exe file and the second package is the entire USMT X86 scanstate files and folders, (note: in this example we are using scanstate from the X86 folder).

 

This means that we create a separate package to the normal USMT4 package and this is only because this example is a workaround or proof of concept to prove that Offline Mode in Windows PE can be done via a Task Sequence in SCCM.

 

Update: If you would like sample code to check for and use the correct USMT architecture in offline mode then see Peters post here

 

 

Get your lab ready

 

We need a Windows XP client machine to test scanstate on and you should enable the F8 command prompt option in your boot.wim (you'll need it).

 

 

The Task Sequence

 

You can use this Task Sequence in SCCM by importing it. Please note this task sequence only has the 4 groups in it, if you want the 4 groups plus OSD then use the other Task Sequence further down.

 

Offline Mode in Windows PE using USMT 4.xml

 

The task sequence depends on three packages, the X86 bits from your USMT 4 (ie: copy everything in the X86 folder from C:\Program Files\Windows AIK\Tools\USMT folder. There are two versions, one for 32bit (X86) and one for 64bit (amd64), we are only using the X86 bits in this guide), the Batchfile

 

offline mode references.jpg

 

 

I break up my task sequence into four distinct groups, Set, Create, xcopy and Run

 

SET

 

 

In the Set group I set SystemDrive to c: (otherwise it will try and do this on the windows PE x: drive)

 

set systemdrive variable.jpg

 

Next we set the OSDStateStorePath Task Sequence Variable to %systemdrive%\USMToffline which translates to c:\USMToffline, this directory will store our migration data during scanstate operations and when the new os is being applied.

 

set osdstatestorepath.jpg

 

Finally we set the hardlink load parameters

 

set hardlink load parameters.jpg

 

 

CREATE

 

In the Create group we just create two folders, c:\USMToffline,

 

create usmt offline folder.jpg

 

and c:\USMTbits\X86

 

create usmt bits folder.jpg

 

 

the c:\USMTbits\X86 will store all our scanstate native files.

 

 

XCOPY

 

In the xcopy group we do the clever stuff, we copy the X86 USMT stuff to the newly created folder, and then we copy our batch file for later user.

 

xcopy usmtbits.jpg

 

The batch file itself has the following contents

 

 

@set USMT_WORKING_DIR=%~2%\USMTbits\x86

"%~2\USMTbits\x86\scanstate.exe" "%~1" /c /o /hardlink /efs:hardlink /nocompress /offlinewindir:c:\windows /v:5 /l:%~2\windows\TEMP\SMSTSLog\scanstate.log /progress:%~2\windows\TEMP\SMSTSLog\scanstateprogress.log /i:%~2\USMTbits\x86\miguser.xml /i:%~2\USMTbits\x86\migapp.xml

 

xcopy runscanstate.jpg

 

You can download the batchfile below however you must rename it back to .bat

 

runscanstate-offlinewindir.bat.txt

 

 

RUN

 

The Run group does the actual running of the batch file and passes two variables to the file.

 

do scanstate.jpg

 

 

 

Testing Offline Mode.

 

Create an optional advertisement to a Migrate XP to W7 X86 collection for the Task Sequence and PXE boot your XP client (press F12 first....), select the Task Sequence when the wizard appears,

 

ts wizard welcome.jpg

 

at this point press F8 to bring up the command prompt, you are doing this to verify that your data is getting migrated in OFFLINE mode. So here we can see the command prompt is open.

 

cmd prompt before ts starts.jpg

 

Ok switch back to the TS and start the task sequence. You will see it starts creating the folders, copying the USMT stuff and our batch file(s) and then actually running the scanstate command.

 

copying.jpg

 

do x86 scanstate.jpg

 

Once it is completed your migrated data will now be stored in C:\USMToffline\USMT

 

browse it and verify

 

migrated data stored in usmt offline folder.jpg

 

If you want to see a working SMSTS.log file from the above test see below

 

smsts.log

 

 

Ok now what ?

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

I'm hoping someone can help with this!

 

As stated in my above post, the "do runscanstate x86" step takes forever... after examining my smsts.log... it's almost as if it's not even doing anything for an entire half hour - THEN it starts to migrate the profiles and shows the percentages.

 

Also - since then, for whatever reason, it's telling me my boot image is inaccessible, and thus, my TS fails directly after the scanstate.

 

I've attached my smsts.log ...PLEASE someone help!

smsts.log

Share this post


Link to post
Share on other sites

  • 0

scanstate works fine see here > Successfully complete the action (do X86 scanstate) with the exit win32 code 0

 

after that it trys to apply the operating system (are you sure the OS wim image is correct ?)

 

<![LOG[Not a data image]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="ApplyOperatingSystem" context="" type="0" thread="408" file="applyos.cpp:320">

<![LOG[ApplyOSRetry: ]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="ApplyOperatingSystem" context="" type="0" thread="408" file="applyos.cpp:331">

<![LOG[TSLaunchMode: UFD]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="ApplyOperatingSystem" context="" type="0" thread="408" file="applyos.cpp:332">

<![LOG[OSDUseAlreadyDeployedImage: FALSE]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="ApplyOperatingSystem" context="" type="0" thread="408" file="applyos.cpp:333">

<![LOG[Rebooting and retrying]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="ApplyOperatingSystem" context="" type="0" thread="408" file="applyos.cpp:345">

<![LOG[Process completed with exit code 0]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="commandline.cpp:1102">

<![LOG[!--------------------------------------------------------------------------------------------!]LOG]!><time="16:11:14.844+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="instruction.cxx:3010">

<![LOG[successfully complete the action (Apply Operating System) with the exit win32 code 0

 

and that appears to complete ok, it then claims it needs to retry (possibly due to bad image ?)

 

<![LOG[The action (Apply Operating System) requested a retry]LOG]!><time="16:11:14.954+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="engine.cxx:263">

<![LOG[Reboot to WinPE]LOG]!><time="16:11:14.954+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="engine.cxx:453">

<![LOG[Calling RebootSystem()]LOG]

 

[staging boot image DOT00001]LOG]!><time="16:11:14.954+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="bootimage.cpp:672">

<![LOG[0, HRESULT=80004005 (e:\nts_sms_fre\sms\framework\tscore\encryptablevolume.cpp,368)]LOG]!><time="16:11:15.344+240" date="09-09-2011" component="TSManager" context="" type="0" thread="1708" file="encryptablevolume.cpp:368">

<![LOG[Checking to see if the data path is on a bootable volume]LOG]!><time="16:11:15.344+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="bootimage.cpp:939">

<![LOG[buffer was too small to get disk layout. Trying again with 1248 bytes]LOG]!><time="16:11:15.344+240" date="09-09-2011" component="TSManager" context="" type="1" thread="1708" file="diskutils.cpp:1269">

<![LOG[0, HRESULT=80004005 (e:\nts_sms_fre\sms\framework\tscore\encryptablevolume.cpp,368)]LOG]!><time="16:11:15.359+240" date="09-09-2011" component="TSManager" context="" type="0" thread="1708" file="encryptablevolume.cpp:368">

<![LOG[boot Image not found in local data cache. Staging is required

 

then it claims the boot image is not found (you are using multicasting here it seems also ?)

 

<![LOG[Boot Image package not found.

Unspecified error (Error: 80004005; Source: Windows)]LOG]!><time="16:13:15.386+240" date="09-09-2011" component="TSManager" context="" type="3" thread="1708" file="bootimage.cpp:1002">

 

so is the boot image distibuted to both dps ? is your image wim a valid captured OS ?

Share this post


Link to post
Share on other sites

  • 0

Yes the scanstate action completed with no errors, but if you look here, I get the "Starting the Migration Process" (the first step of the USMT) appears at 15:36, and then it doesn't start the first gathering of profile data until 16:10... if I run the USMT from a full OS standpoint, the gathering of the profile data starts almost immediately. It seems as though there's definitely a hold up here, and the ts is idle for about 30 minutes during the 'run scanstate x86' portion:

 

 

<![LOG[Starting the migration process]LOG]!><time="15:36:17.171+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[Offline engine startup from WinDir - c:\windows]LOG]!><time="16:10:33.614+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[Processing the settings store]LOG]!><time="16:10:33.614+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[]LOG]!><time="16:10:33.614+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[Examining the system to discover the migration units]LOG]!><time="16:10:33.614+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[]LOG]!><time="16:10:33.614+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[ S-1-5-21-1210859283-1907650544-1231754661-71091 (SWDist) (1 of 4): 0% done ]LOG]!><time="16:10:33.879+240" date="09-09-2011" component="InstallSoftware" context="" type="1" thread="1812" file="runcommandline.cpp:34">

<![LOG[ S-1-5-21-1210859283-1907650544-1231754661-71091 (SWDist) (1 of 4): 42% done ]LOG]!><time="16:10:33.879+240" date="09-09-2011" component="InstallSoftware"

 

As for the OS image, there shouldn't be any problems with it. There's nothing out of the ordinary on the WIM file, and I've used it countless times in my standalone Windows 7 Base Image task sequence. Correct me if I'm wrong, but the steps here would be:

 

Scanstate

Stage the boot image

Apply the Operating System

 

It seems as though the root of the problem is that the boot image is not being loaded successfully (although it works fine from another TS), and yes, I've updated the x86 boot image on both DPs. Why would it try to apply the operating system before the boot image is even loaded?

 

As for the scanstate.log, that's the one thing I am going to check as soon as I get back to the office on Monday. I was about to examine it briefly on Friday evening before I left, but I checked both C:\USMTbits\x86 and X:\Windows\temp and I did not see it listed there from within the command shell.

 

Thanks in advance for your help guys! I really want to tackle this.

Share this post


Link to post
Share on other sites

  • 0

I seem to be getting a weird error...

 

 

The task sequence execution engine failed executing the action (xcopy X86 USMT to USMTbits\X86) in the group (xcopy) with the error code 4

Action output: es\sp10002b\x86\replacementmanifests\microsoft-windows-terminalservices-licenseserver is a directory. Setting directory security

c:\_smstasksequence\packages\sp10002b\x86\replacementmanifests\usb is a directory. Setting directory security

c:\_smstasksequence\packages\sp10002b\x86\replacementmanifests\windowssearchengine is a directory. Setting directory security

Content successfully downloaded at C:\_SMSTaskSequence\Packages\SP10002B

Resolved source to 'C:\_SMSTaskSequence\Packages\SP10002B'

Set command line: Run command line

Working dir 'C:\_SMSTaskSequence\Packages\SP10002B'

Executing command line: Run command line

‰????????Process completed with exit code 4

Command line returned 4

Entering ReleaseSource() for C:\_SMSTaskSequence\Packages\SP10002B

reference count 1 for the source C:\_SMSTaskSequence\Packages\SP10002B before releasing

Delete source directory C:\_SMSTaskSequence\Packages\SP10002B

Invalid drive specification

Released the resolved source C:\_SMSTaskSequence\Packages\SP10002B. The operating system reported error 4: The system cannot open the file.

 

It creates the two folders for USMTbits & Offline?

 

sp10002b is my USMT package??? I've tried updating the DP?

 

Any ideas? It only seemed to stop working since I put the workaround path into XCOPY....

 

This is the path I'm using...

 

xcopy %_SMSTSSP10002B%* %USMTDrive%\USMTbits /herciy

Share this post


Link to post
Share on other sites

  • 0

Looking into SMSTS.log

 

I can see

 

Content location request for SP100014:1 failed. (Code 0x80040102)

 

But looking through all my packages, os & task sequences I cannot find a reference for SP100014 ????

 

Any ideas?

 

I'm thinking it must be something to do with my scan state package...does it need a program ??? I've just dropped the batch file into a folder and pointed the source files to that folder in the package?

Share this post


Link to post
Share on other sites

  • 0

pss53, I'm pretty sure that the runstanstate.bat does NOT need a program from within the package... it was working for me without one just last week.

 

Alas, I'm still stuck. However, in case anyone is interested, I was able to determine *why* the runscanstate.bat was taking so long.... this was because in the scanstate.log file, it was trying to copy profiles that were absent in reality and had no ntuser.dat file, but still existed as a SID # within the registry (but had no profile data to be found). Therefore, it was trying to copy each of these nonexistent profiles about twenty times each, failing each time since it could not find the data in C:\Documents and Settings, and waiting six seconds between each retry. I was able to circumnavigate this issue by using the following line in the runscanstate.bat:

 

SET MIG_IGNORE_PROFILE_MISSING=1

 

Now my other issue is still the boot image. Is it normal for the boot image to be copied to C:\_SMSTaskSequence\Packages\DOT0001 (the last part being the package identifier of my x86 boot image)? I read earlier in this thread that you need to have the advertisement set to "download content when needed by task sequence" instead of the "access content directly," so I set it as such. I do have my boot image set to "Allow transfer over multicast (winPE only)" and "Encrypt multicast packages"; should this make a difference?

 

Also, I've tried a substitute boot image, an alternate operating system image, and I've tried re-advertising the task sequence.. so that rules those out. Therefore, I'm almost certain that it's an issue within either the properties of the boot image, or the properties of the specific advertisement..

 

In my smsts log file, I see:

 

Boot Image package not found.

Unspecified error (Error: 80004005; Source: Windows) TSManager 9/12/2011 10:20:20 AM 1752 (0x06D8)

 

Entering ReleaseSource() for C:\_SMSTaskSequence\Packages\DOT00001 TSManager 9/12/2011 10:20:20 AM 1752 (0x06D8)

 

The user tries to release a source directory C:\_SMSTaskSequence\Packages\DOT00001 that is either already released or we have not connected to it TSManager 9/12/2011 10:20:20 AM 1752 (0x06D8)

 

BootImage::ResolveImageSource( pszPackageId, sImagePackageSourcePath, sImageSourcePath), HRESULT=80004005 (e:\nts_sms_fre\sms\framework\tscore\bootimage.cpp,687) TSManager 9/12/2011 10:20:20 AM 1752 (0x06D8)

 

TS::Boot::BootImage::StageBootImage(sBootImageID, StageBootImageProgressCallback, (LPVOID) m_sStageBootImageMessage.c_str()), HRESULT=80004005 (e:\nts_sms_fre\sms\client\tasksequence\executionengine\engine.cxx,816) TSManager 9/12/2011 10:20:20 AM 1752 (0x06D8)

 

Failed to stage a boot image DOT00001.

Unspecified error (Error: 80004005; Source: Windows) TSManager 9/12/2011 10:20:21 AM 1752 (0x06D8)

 

 

I'm really not sure what any of this means, aside from the fact that it was unable to download the boot image locally (aka stage), and therefore it cannot launch. I wish this would start working :blink:

post-11371-0-74321600-1315831972_thumb.jpg

Share this post


Link to post
Share on other sites

  • 0

Got it... after I unchecked the "Allow this package to be transferred via multicast (WinPE only)" and "Encrypt multicast packages" from within the boot image properties, the TS was able to download and stage the boot image package properly.... I'm not sure yet which one of those settings was the instigator... can anyone enlighten me as to why these options were interfering?

post-11371-0-62084700-1315835511_thumb.jpg

Share this post


Link to post
Share on other sites

  • 0

I have run this and on most of my PC's it is working flawlessly. On a few it does not bring the profiles back (they are in USMToffline). I believe it is due to local accounts. But my real question is what can I do to manually bring these back. I assume some sort of command line run using loadstate.exe

Share this post


Link to post
Share on other sites

  • 0

You would do a loadstate command using the proper syntax, i.e.:

 

loadstate C:\USMTBits /i:miguser.xml /i:migapp.xml /uel:60

 

The syntax is here:

 

http://technet.micro...28WS.10%29.aspx

 

I believe if you're running in the WinPE environment, you will need the "/offline:windir:<windows directory path>" switch, and of course the /hardlink and /nocompress switches for the hardlinked data.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.