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

Has it ever been determined why user data is not being restored but instead still sitting in the USMTOffline folder?

 

I receive a task sequence error when it attempts to restore, when I login I can see all the data in the folder but it is not restored. My USMT 4 package points to the USMT root folder with the x86 and x64 subfolders within. I have it set so advertisement data is downloaded to the DP.

Share this post


Link to post
Share on other sites

  • 0

Which error do you get?

 

I will run it again at work tomorrow and reply back. I've been trying a few different methods trying to get this to work and the furthest I've gotten so far is just not having the data restore back into the directories. I've also tried using this method instead:

 

http://blogs.technet.com/b/configurationmgr/archive/2010/06/30/how-to-use-usmt-4-hardlinking-in-a-configuration-manager-2007-task-sequence.aspx

 

So I could use it also for W7 to W7 rebuilds but I get an immediate error on my first task sequence when I try to restart into the full Windows OS, it gives me an error code that translates to the operation is not allowed.

 

Does anyone mind sharing their XML so I can compare to what I have setup to see where I may be going wrong.

Share this post


Link to post
Share on other sites

  • 0

Right now I am using a different method which seemed to work without errors on the screen, however data was still not restored.

 

http://sccm.haas.se/?p=272

 

Error is IsUSMTPreLonghorn failed (0x80070002)

UserStateMigrationAction: GetUSMTBinaryFailed (0x80070003)

Failed to initialize

Failed to run the action Restore User State. The system cannot find the file specified.

 

Right now I am trying the capture with the USMT package point to the USMT root and then with the restore USMT package pointed directly to x86 to see if it is having issues deciphering what to execute. I can see all the USMT files (x86 and x64) being downloaded right before trying to execute the restore function, so I am wondering if it is looking in the USMT root and not seeing the file it needs.

 

I cannot find a loadstate log on the PC when going into F8. I can only see the smts logs.

post-11088-0-10401900-1314131381_thumb.jpg

Share this post


Link to post
Share on other sites

  • 0

I did a bit more digging today and was looking through the Config Mgr. It looks like our primary site had the latest SCCM client installed, however the secondary sites never had their packages updated with the latest SP2 client, so they were installing SP1 which was in their package folder. I've updated the sites this evening and am hoping this will fix the issue, I know SP2 is needed for USMT 4 to work, so if all my other items are in order - I'm hoping to report back with success!

Share this post


Link to post
Share on other sites

  • 0

Well, I finally got things working...my two main issues were that the central site had SP2 Config Mgr. Client but the distribution points had not been updated.

 

After updating those, I had to include the following in my scanstate.

 

/ui:*.* /ue:Administrator /ue:*\*

 

You could also do %computername%\* if you have accounts which have a \ in them which need to be migrated. I did not want any local accounts to be migrated.

Share this post


Link to post
Share on other sites

  • 0

I've got this working now - thanks anyweb for your excellent work!

 

One question: when firing off the TS, everything seems to work properly.. no significant errors or anything, but the "do x86 scanstate" stage seems to take a long while - i.e. 25-40 minutes plus, even for a base image with nothing on it. I am familiar with the USMT outside of SCCM, and I do know that when running in the Windows XP OS, it's definitely quicker than that. Is there something that my "do x86 scanstate" portion of the TS is getting held up on? I tried checking the scanstate.log, but it was nowhere to be found in the C:\USMTbits\x86 folder - which could mean that the scanstate hasn't even started yet and is still "hung." Eventually, it does go through though.... anyone else experience this?

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.