AVD VM Sysprep never ends, gets stuck

Richard Forester 30 Reputation points
2023-12-12T14:58:41.1733333+00:00

Hello. I am trying to get an updated VM (that had been working fine until now) to sysprep as part of creating new VMs for an AVD pool. But sysprep isn't completing like usual. It starts off and gets to "Processing generalize phase Sysprep plugins". Looking at the log, it shows it started SysprepGeneralize (Appx) and then stops logging and never ends. There are no error messages. Typically, this process only takes couple minutes to complete. But after an hour I just stop it because it's not making progress.

Here's the tail of the log:

2023-12-12 06:15:20, Info SYSPRP Entering SysprepGeneralize (Appx).

2023-12-12 06:15:21, Info SYSPRP All appx packages were verified to be inbox or alluser installed.

2023-12-12 06:15:21, Info SYSPRP Package Microsoft.Wallet_2.4.18324.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:22, Info SYSPRP Package Microsoft.UI.Xaml.2.7_7.2208.15002.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:22, Info SYSPRP Package Microsoft.UI.Xaml.2.7_7.2208.15002.0_x86__8wekyb3d8bbwe was removed

2023-12-12 06:15:22, Info SYSPRP Package Microsoft.UI.Xaml.2.3_2.32002.13001.0_x86__8wekyb3d8bbwe was removed

2023-12-12 06:15:23, Info SYSPRP Package Microsoft.UI.Xaml.2.3_2.32002.13001.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:24, Info SYSPRP Package Microsoft.WindowsSoundRecorder_10.2103.28.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:25, Info SYSPRP Package Microsoft.ZuneVideo_10.22091.10031.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:26, Info SYSPRP Package Microsoft.WindowsAppRuntime.1.2_2000.777.2143.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:26, Info SYSPRP Package Microsoft.ZuneMusic_11.2212.31.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:27, Info SYSPRP Package Microsoft.WindowsAppRuntime.1.2_2000.802.31.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:28, Info SYSPRP Package Microsoft.WindowsAppRuntime.1.2_2000.802.31.0_x86__8wekyb3d8bbwe was removed

2023-12-12 06:15:28, Info SYSPRP Package Microsoft.VCLibs.140.00_14.0.32530.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:28, Info SYSPRP Package Microsoft.UI.Xaml.2.8_8.2310.30001.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:29, Info SYSPRP Package Microsoft.UI.Xaml.2.8_8.2310.30001.0_x86__8wekyb3d8bbwe was removed

2023-12-12 06:15:29, Info SYSPRP Package Microsoft.WindowsCamera_2023.2311.5.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:30, Info SYSPRP Package Microsoft.549981C3F5F10_4.2308.1005.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:31, Info SYSPRP Package Microsoft.MicrosoftEdge.Stable_119.0.2151.97_neutral__8wekyb3d8bbwe was removed

2023-12-12 06:15:32, Info SYSPRP Package microsoft.windowscommunicationsapps_16005.14326.21752.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:32, Info SYSPRP Package Microsoft.SkypeApp_15.109.3209.0_x64__kzf8qxf38zg5c was removed

2023-12-12 06:15:33, Info SYSPRP Package AdobeAcrobatReaderCoreApp_23.0.0.0_x64__pc75e8sa7ep4e was removed

2023-12-12 06:15:35, Info SYSPRP Package Microsoft.Windows.Photos_2023.11110.6001.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:35, Info SYSPRP Package Microsoft.People_10.2202.33.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:36, Info SYSPRP Package Microsoft.BingWeather_4.53.52331.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:37, Info SYSPRP Package Microsoft.WindowsMaps_11.2311.1.0_x64__8wekyb3d8bbwe was removed

2023-12-12 06:15:37, Info SYSPRP Package Microsoft.WindowsStore_22311.1401.2.0_x64__8wekyb3d8bbwe was removed

Here are the commands I'm using:

cd C:\Windows\System32\Sysprep

sysprep.exe /generalize /oobe /mode:VM /shutdown

Can someone please give me some suggestions as to what's wrong?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,041 questions
Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,584 questions
{count} vote

4 answers

Sort by: Most helpful
  1. Richard Forester 30 Reputation points
    2023-12-19T22:03:12.55+00:00

    Hello @Tennyson Onovwiona , @vipullag-MSFT , @AngryTech

    We have discovered a solution that might work. We found several user profiles on the VM created from the snapshot that showed "Account Unknown" and deleted them. After that sysprep worked as usual. We have been successful with this solution twice already, so I don't think it's a fluke. Hopefully you find this helpful.

    User's image

    3 people found this answer helpful.

  2. vipullag-MSFT 26,396 Reputation points
    2023-12-15T09:33:12.0966667+00:00

    Hello Richard Forester

    Thanks for confirming that the marketplace image works without any issues.
    The recommended process for custom images is to start always on a clean marketplace image and don’t build “custom-image-chains” as it is very hard to troubleshoot when things break.
    If the image build process is automated, can you please check this custom image template feature to help with building an image:
    https://learn.microsoft.com/en-us/azure/virtual-desktop/create-custom-image-templates

    For your current issue, the best option would be to get a support case logged to investigate why the sysprep is getting struck.

    0 comments No comments

  3. Klown Icle 15 Reputation points
    2024-01-06T23:03:00.2+00:00

    I'm guessing this has something to do with Sysprep and VM's to an extent. I use Hyper V to create Images and ever since Nov/Dec, I'm having repeated stalls with sysprep. I was able to see that removing the Account I'm using and re-adding had a strong success rate but overall I haven't narrowed down the cause. It's always stalling on an appx package of sorts. If you force remove all appx packages the problem resolves itself. I haven't tested to see if removing all the appx packages for the account i'm working with resolves it as of it yet. But never-the-less, this is some bug that's been introduced in sysprep.

    0 comments No comments

  4. SDave 0 Reputation points
    2024-06-05T21:11:38.1333333+00:00

    We had this exact same issue, resolved it by using an 'in-place' 22H2 upgrade (by using a 22H2 ISO and running setup).

    Pretty sure what this means is that there was some kind of file system corruption. Based on what I understand - something to do with the component store. It seems likely the admin profile got corrupted as well, because after the failed sysprep the start menu stopped working. The part that doesn't make sense is why a dism /restorehealth and sfc/scannow are not fixing the problem. Those commands are advertised as the 'be all and end all' for component store corruption.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.