When Should I Run the Windows 11 (22H2) – Modify Sysprep Script?
When using the Windows 11 (22H2) image that is AD-joined, you must run the Windows 11 22H2 – Modify Sysprep script every time when performing the Power off & set as image operation.
Note: You can perform the Power off & set as image operation during the business hours without disrupting the end-user sessions. End users do not connect to this desktop image.
Assign the Windows 11 22H2 – Modify Sysprep Script to Your Customer Account
The Windows 11 22H2 – Modify Sysprep script is available from your global MSP level, and needs to be assigned to your customer account before you can run it.
To assign the script to your customer account:
At the MSP level, navigate to Scripted Actions > Windows scripts.
On the Windows scripts blade, search for the Windows 11 scripts.
From the action menu next to the Windows 11 22H2 – Modify Sysprep script, select Assign accounts.
In the new dialog box, from the drop down, select the account to assign the scripted action to, and then select OK.
Run the Windows 11 22H2 – Modify Sysprep Script
Once you have assigned the Windows 11 22H2 – Modify Sysprep script to your customer account, you can run it on their Windows 11 (22H2) image.
Warning: Make sure you run the Windows 11 22H2 – Modify Sysprep script during every Power off & set as image operation. If the script is not run, the Sysprep fails, and errors occur when re-imaging the host pool.
To run the script:
Navigate to your customer account Desktop images blade.
Next to the Windows 11 22H2 image, select Power off & set as image.
In the Set [your image name] as an image dialog box, do the following:
If your customer has an Azure Compute Gallery, turn the Geographic distribution & Azure compute gallery option On. Then, in Azure Compute Gallery, select the gallery and define the Azure Regions and Storage Account Type fields.
Turn the Run the following scripted actions before set as image option On.
In the Windows Scripts section, select the Windows 11 22H2 – Modify Sysprep script.
Select the following options:
Pass AD credentials to pass to the script the credentials you defined in the Settings > Integrations page.
Retain current image object to retain this image as a standalone object and not overwrite it with the new image, and then define the number of versions to retain.
In the Change log field, enter the operation details and select OK.
After the script runs successfully, you need to re-image your host pool with the latest image. For details, see How Do I Update a Desktop Image and Hosts?
Warning: Re-imaging the host pool during the business hours will terminate all the active AVD sessions.
Once the host pool is re-imaged, verify that the latest image is defined in the Desktop image (template) field of the host pool auto-scale settings (Host pool > Auto-scale > Configure page). For details, see Auto-scale Settings for Host Pools.