Hi RR
Regarding the issues you're facing with creating an image in Azure and using sysprep, let's address each one separately:
- 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.
- 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 thesysprep
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.
After removing the unnecessary lines and ensuring that the VM has completed the sysprep process before shutting down, try creating the image again.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
- Timeouts: You can remove the
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".