Fix Optimize_OS_for_AVD.ps1 compatibility with updated Virtual-Desktop-Optimization-Tool repository #851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
Optimize_OS_for_AVD.ps1script was broken due to breaking changes in the upstream Virtual-Desktop-Optimization-Tool repository:Win10_VirtualDesktop_Optimize.ps1no longer exists in the VDOT repositoryWindows_VDOT.ps1now requires a mandatory-Optimizationsparameter (see VDOT documentation)Windows_VDOT.ps1separately when it's already included in the downloaded zip archiveThese issues caused VM image builds to fail, with VMs stuck in 'creating' state and eventually timing out.
Changes
This PR makes minimal, surgical changes to fix the compatibility issues:
1. Removed redundant script download (lines 20-22)
The script is already included in the zip archive, making this download unnecessary.
2. Removed references to deprecated Win10_VirtualDesktop_Optimize.ps1
This script no longer exists in the VDOT repository.
3. Added mandatory -Optimizations parameter and simplified execution
The script now runs
Windows_VDOT.ps1once with the mandatory-Optimizations Allparameter instead of attempting to run both old and new scripts.4. Fixed path casing consistency
Ensured consistent casing with other hardcoded paths in the script.
Testing
-Optimizations Allparameter matches VDOT documentation requirementsImpact
The script now correctly works with the latest version of the Virtual-Desktop-Optimization-Tool repository and should resolve VM image build failures.
Fixes #844
Original prompt
Fixes #817
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.