Optimize the Azure Virtual Desktop (AVD) golden image automatically

For Azure Virtual Desktop (AVD) there is an Optimization Tool available called Virtual Desktop Optimization Tool (VDOT). With this tool/script you optimize the following categories within an Azure Virtual Desktop (AVD):

    • Universal Windows Platform (UWP) app cleanup
    • Optional Features cleanup
    • Local policy settings
    • System services
    • Scheduled tasks
    • Apply Windows (and other) updates
    • Automatic Windows traces
    • Windows Defender optimization
    • Client network performance tuning by registry settings
    • Additional settings from the “Windows Restricted Traffic Limited Functionality Baseline” guidance.
    • Disk cleanup

Optimizing the AVD Golden Image will improve the User Experience, so it is highly recommended to use it. Vendors such as VMware (VMware OS Optimization Tool) and Citrix (Citrix Optimizer Tool) use their own tools for optimizing their Golden Images.

To optimize an AVD image you must do some things manually before you run the Virtual Desktop Optimization Tool (VDOT). I created a PowerShell script that downloads the latest VDOT and optimizes the AVD image automatically.

The PowerShell script below does the following:

  • Create a folder on the AVD  VM called c:\optimize
  • Download the latest Virtual Desktop Optimization Tool
  • Expand the Virtual Desktop Optimization Tool  zip file to the c:\optimize folder
  • Remove the VDOT Archive file
  • Download a modified apppackages.json file. The default apppackages.json file will enable all the APPX packages.
  • Copy the apppackages.json file to the configuration folder for each build
  • Unblock all the downloaded files
  • Execute the Virtual Desktop Optimization Tool
  • Remove the c:\optimize folder
  • Reboot the AVD host
<#
    .SYNOPSIS
        Virtual Desktop Optimalization Tool (VDOT)
    .DESCRIPTION
        Download the Virtual Desktop Optimalization Tool (VDOT), creates a folder called optimize and runs VDOT tool.
        The VDOT tool determines OS version at run-time
    .NOTES
        Version:        1.0
        Author:         Ivo Beerens
                        info@ivobeerens.nl
        Creation Date:  25-02-2022
        Plattform:      Azure VIrtual Desktop (AVD)
        Changelog:      
                        25-05-2022      1.0 - Initial script development
    .COMPONENT

    .LINK
 
    .Example
        Script needs to be run with PowerShell elevated
#>

# Variables
$verbosePreference = 'Continue'
$vdot = 'https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool/archive/refs/heads/main.zip' 
$apppackages = 'https://raw.githubusercontent.com/ibeerens/AVD/main/vdot/ConfigFiles/AppxPackages.json'
$vdot_location = 'c:\Optimize' 
$vdot_location_zip = 'c:\Optimize\vdot.zip'
$apppackages_location = 'C:\Optimize\AppxPackages.json'

# Enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Clear screen
Clear

# Create Folder
$checkdir = Test-Path -Path $vdot_location
if ($checkdir -eq $false){
    Write-Verbose "Creating '$vdot_location' folder"
    New-Item -Path 'c:\' -Name 'Optimize' -ItemType 'directory' | Out-Null
}
else {
    Write-Verbose "Folder '$vdot_location' already exists."
}

# Download VDOT
Write-Verbose "Dowmload VDOT" 
Invoke-WebRequest -Uri $vdot -OutFile $vdot_location_zip

# Expand Archive
Write-Verbose "Expand Archive" 
Expand-Archive $vdot_location_zip -DestinationPath $vdot_location -Verbose -Force

# Remove Archive
Write-Verbose "Remove Archive" 
Remove-Item $vdot_location_zip

# Download AppPackages
Write-Verbose "Dowmload Apppackages.json APPX file" 
Invoke-WebRequest -Uri $apppackages -OutFile $apppackages_location

# Copy the AppPackage file to all versions
Write-Verbose "Copy Apppackages.json to all configurationfiles folders" 
Copy-Item $apppackages_location -Destination 'C:\Optimize\Virtual-Desktop-Optimization-Tool-main\1909\ConfigurationFiles\AppxPackages.json'
Copy-Item $apppackages_location -Destination 'C:\Optimize\Virtual-Desktop-Optimization-Tool-main\2004\ConfigurationFiles\AppxPackages.json'
Copy-Item $apppackages_location -Destination 'C:\Optimize\Virtual-Desktop-Optimization-Tool-main\2009\ConfigurationFiles\AppxPackages.json'

# Unblock all files
Write-Verbose "Unblock all files" 
dir $vdot_location -Recurse | Unblock-File

# Change folder to VDOT
Write-Verbose "Change folder to VDOT location" 
$vdot_folder = $vdot_location + '\Virtual-Desktop-Optimization-Tool-main' 
cd $vdot_folder

Write-Verbose "Run VDOT" 
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
.\Windows_VDOT.ps1 -Verbose -AcceptEULA

# Sleep 5 seconds
sleep 5

# Remove folder
Write-Verbose "Remove Optimize folder" 
cd \
Remove-Item $vdot_location -Recurse -Force

# Restart AVD Golden image
Restart-Computer -Force

You can use this script in your AVD Golden Image building process. The Virtual Desktop Optimization Tool (VDOT) changes a lot of settings so be sure to test your image very carefully. The script can be found on my GitHub, link.

Resources to prepare for the AZ-140 Azure Virtual Desktop (AVD) exam

I’m preparing for the AZ-140 Azure Virtual Desktop (AVD) exam.

Update: June 10, 2021, the exam is out of beta and Generally Available (Link).

The following resources I’m using for studying for the exam:

Create a free Azure account to get some hands-on lab experience

The Azure Academy did a great job and created  a series of AZ-140 study guides on YouTube:

Travis Roberts has created a training course and a set of exam questions for the AZ-140 exam on Udemy:

Pluralsight is free this month (April 2021). So take your change

Exam tips:

I hope that these resources will help you pass the AZ-104 exam. Let me know in a comment below about your experience with the AZ-104 exam.

Microsoft Windows Virtual Desktop (WVD) learning resources

As an End User Computing (EUC) consultant I’m looking for a couple of weeks into Microsoft Windows Virtual Desktop (WVD). My first step was to take the on-line course “Zero to Hero with Windows Virtual Desktop WVD” from Travis Roberts. I can highly recommend this course to everyone who is starting with Microsoft WVD.

Here’s a list of useful resources I discovered during my journey (this list will be updated frequently).

General

Website Description
Microsoft WVD website The official Microsoft WVD Website
WVD UserVoice Helping improve Windows Virtual Desktop
WVD Tech Community Windows Virtual Desktop discussion forum
What’s new in Windows Virtual Desktop The latest new enhancements in WVD
Christiaan Brinkhoff blog Microsoft WVD Evangelist with great content
Microsoft WVD roadmap Microsoft WVD roadmap

Community / User Groups

Website Description
WVD Community site A single place where you can go to learn about everything related to Windows Virtual Desktop.
WVD Dutch User group YouTube Dutch WVD User group
WVD Dutch User Group meetings YouTube WVD Dutch User Group recordings
Slack WVD Community Slack WVD Community

Tools

Website Description
WVDAdmin Marcel Meurer created an additional tool to manage WVD
Windows Virtual Desktop Experience Estimator Your tool to estimate the quality of the experience your users will receive when connecting to Windows Virtual Desktop
Windows WVD desktop clients Windows WVD desktop clients
MSIX app attach Azure portal integration public preview MSIX app attach Azure portal integration public preview
WVD Optimization tool WVD Optimization tool
Az Mask This is a browser extension that will mask GUIDs (such as Subscription IDs), email addresses, keys, and connection strings with a blur. Very useful for presentations.
Auto Start/Stop script  This script is intended to automatically start and stop session hosts in a Windows Virtual Desktop
host pool based on the number of users

Articles

Website Description
MicroCloud How to – Add a Dutch language pack to WVD
Sander Rozemuller blog A lot of WVD automation examples
Windows Virtual Desktop QuickStart The WVD QuickStart solution simplifies and automates the WVD deployment process leveraging the power of Azure DevOps
Rudlintech Ltd. Windows Virtual Desktop imaging using Azure Devops CI/CD, Packer and PowerShell

AZ-104 Exam preparation

For an up-to-date list see my “Resources to prepare for the AZ-140 Configuring and Operating Windows Virtual Desktop on Microsoft Azure exam” article.

Microsoft WVD Learning resources Deliver remote desktops and apps from Azure with Windows Virtual Desktop
AZ-140 Exam overview AZ-140 Exam overview
Microsoft Certified: Windows Virtual Desktop Specialty
– Skills Measured
Microsoft Certified: Windows Virtual Desktop Specialty
– Skills Measured
AZ-104: Microsoft Azure Administrator GitHub AZ-104: Microsoft Azure Administrator GitHub
AZ-140 Windows Virtual Desktop Speciality Study Guide AZ-140 Windows Virtual Desktop Speciality Study Guide

 

Training / YouTube Channels

Website Description
Azure Academy Azure Academy channel
Travis Roberts Travis Roberts YouTube channel
Zero to Hero with Windows Virtual Desktop WVD WVD training
WVD Workshop Micha Wets Microsoft & Cloud-Architect WVD Workshop
WVD on sizing and licensing Wayne Chapin explains WVD on sizing and licensing.
Dutch WVD YouTube channel Dutch WVD YouTube chanel
Christiaan Brinkhoff YouTube Channel Christiaan Brinkhoff YouTube Channel with a lot of WVD information