Friday, November 5, 2010

Sysprep 0x8007139f Error on Windows 7

For those of you keeping track the Sysprep issues continue.

While finishing up a windows image and after the previous Sysprep CopyProfile (also worth a read if unsure how to debug sysprep problems) issues. I ran into another sysprep error in C:\Windows\Panther\UnattendGC\setupact.log with error "Failure occured during online installation. Online installation cannot complete at this time.; hr = 0x8007139f"  This was the format of the file.

[windeploy.exe] WinDeploy.exe exiting with code [0x0]
[windeploy.exe] ------------------------------------------------
[windeploy.exe] WinDeploy.exe launched with command-line []...
[windeploy.exe] Setup has not completed, adding pending reboot.
[windeploy.exe] SetupCl has pending operations; blocking deployment process until they've been completed.
[windeploy.exe] Failure occured during online installation.  Online installation cannot complete at this time.; hr = 0x8007139f
[windeploy.exe] Flushing registry to disk...
[windeploy.exe] Flush took 344 ms.
[windeploy.exe] WinDeploy.exe exiting with code [0x8007139f]
[windeploy.exe] ------------------------------------------------

Looking into the issue it appears to be a not so uncommon issue with Windows 7. However most people seem to oddly go about testing for the cause by testing every piece of software on the box one at a time.

The Problem
The issue is linked with registry keys that appear to cause problems for sysprep.
  • The System doesn't have full access to some registry key.
  • A registry key is larger than 8 Kb.
  • Registry is corrupted in some way.
The Solution
While the normal setupact.log is enough for most sysprep problems for this one we have to read the file "C:\Windows\Panther\setup.etl". To do so copy the file to a machine where can open Windows Event Viewer and use Open Saved Log. We didn't use notepad due to the format of the file not being very human readable. It can be done but but why.
setup.etl from machine with 0x8007137f error.
Once you have the log open, look for errors. Mine was 6 errors in a row. All containing and repeating with descendant registry paths:
SclRegProcessKeyRecursiveByHandle@330 : (80000005): Failed to process reg key or one of its descendants:

In my case they all were from [\REGISTRY\USER\.DEFAULT\] and its descendants.

The Fix was to restore my machine to previous state before  sysprep was run (VMware Snapshot in my case). Download Windows 7 and Windows 2008 Hotfix KB 981542 ( Then rerun sysprep with the same file which ended successfuly.

Others have reported that this hotfix didn't solve this problem for them. In those cases you should be able to narrow down the cause based on the Registry key listed in the "Failed to process reg key or one of its descendants" error.



  1. In my case I was getting the error on Windows 2008R2 XenApp 6.5 server and it turned out to be one of the users profiles in the c:\Users directory that was causing the problem. After deleting all the user profiles, my server was able to sysprep.

  2. Just ran across this article as working on this problem all day. In my case, my setup.etl was corrupt, so I was unable to find a solution that way, however with the comment above, mine was also a XenApp 6.5 server. I deleted all user profiles and the sysprep started to work! Thanks Anonymous!


Please leave a comment; someone, anyone!