image issue

Roger Roger 4,961 Reputation points
2023-04-13T18:21:05.2066667+00:00

Hi All I have created Windows 11 VM in Azure and i want to create image from this VM. i have created image & when i deploy VM in Azure from this image i am getting operation timeout error. i am using sysprep using the below command. please guide me.

cd /d %WinDir%\system32\sysprep
@ECHO 'Removing Store Limiting Reg Keys'
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore /v AutoDownload /f
reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager /v SilentInstalledAppsEnabled /f
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CloudContent /v DisableWindowsConsumerFeatures /f
@Timeout /t 30
sysprep /generalize /oobe 
@Timeout /t 30
shutdown /s /t 5

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,515 questions
Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,834 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,467 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Khaled El-Sayed Mohamed 1,160 Reputation points
    2023-07-24T09:50:12.32+00:00

    Hi RR

    Regarding the issues you're facing with creating an image in Azure and using sysprep, let's address each one separately:

    1. Image Creation Timeout Error: When creating a custom image in Azure, there could be various reasons for an operation timeout error. Here are some steps to troubleshoot the issue:
      • Check VM Status: Ensure that the VM is in a running state and has sufficient resources available during the image creation process.
      • Disk Size: Make sure that the VM's OS disk has enough free space to create the image. You might need to increase the OS disk size before creating the image.
      • Network Connectivity: Verify that the VM has proper network connectivity to communicate with Azure services during the image creation process.
      • Resource Locks: Check if there are any locks or policies on the VM or the resource group that could be causing the issue.
      • Try Deallocating VM: Before creating the image, try deallocating the VM (stopping it without retaining the resources) to ensure it's not in a locked or busy state.
      If the issue persists, review the Azure portal logs and the activity log for any error messages that could provide more insight into the problem. If you still can't identify the root cause, consider contacting Microsoft Azure Support for assistance.
    2. Sysprep Commands: The commands you provided in the sysprep script seem fine for the purpose of generalizing the Windows 11 VM and preparing it for image capture. However, there are a few points to note:
      • Timeouts: You can remove the @Timeout /t 30 lines, as the sysprep command already includes a built-in timeout (3 minutes by default) before it starts the generalize process.
      • Shutdown Command: The shutdown /s /t 5 command is shutting down the VM immediately after running sysprep. This could be the reason you're getting a timeout error when creating the image, as the VM might not have completed the sysprep process before shutting down. You should remove this line from the script.
      The simplified sysprep script should look like this:
         cd /d %WinDir%\system32\sysprep
         @ECHO 'Removing Store Limiting Reg Keys'
         reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore /v AutoDownload /f
         reg delete HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager /v SilentInstalledAppsEnabled /f
         reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CloudContent /v DisableWindowsConsumerFeatures /f
      
         sysprep /generalize /oobe /shutdown
      
      After removing the unnecessary lines and ensuring that the VM has completed the sysprep process before shutting down, try creating the image again.

    If you encounter any issues after making these changes, review the Azure portal logs and activity log for error messages, and consider reaching out to Microsoft Azure Support for further assistance.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments