Optimize your Windows 10 single and multi-session images with the new (Windows) Virtual Desktop Optimization Tool


This is the same blog article posted here on the Microsoft Tech Community website. 

Optimizing images has always been an important component of preparing images as part of a traditional  Remote Desktop Services (RDS) infrastructure or virtual desktop infrastructure (VDI). Optimizing session hosts, in particular, can increase user density and eventually lower costs.

With the Virtual Desktop Optimization Tool, you can optimize your Windows 10, version 2004 multi- and single-session deployments in Azure Virtual Desktop.

Note: The information in this post is community-driven; nothing has yet been officially launched by the Azure Virtual Desktop product team. Credit goes to Robert M. Smith and Tim Muessig from Microsoft, previously known as the VDIGuys, for creating this tool and make it available for free for the community.

Windows 10 multi-session image name change

As noted in recent announcements, Office 365 ProPlus is now Microsoft 365 apps for Enterprise. With this name change, we have updated the Azure Virtual Desktop image names in Azure Marketplace. As a result, when you are looking for an image in the Azure Marketplace image gallery, you should begin by selecting Windows 10 Enterprise multi-session, version 2004 + Microsoft 365 Apps – Gen1 as your baseline image


How the Virtual Desktop Optimization Tool works

The (Windows) Virtual Desktop Optimization Tool disables services in the operating system that you most likely won’t need for your Azure Virtual Desktop session host. To make sure that your line-of-business (LOB) applications continue running as they should, there are some preliminary steps that should first performed.

Note: There are settings default disabled when you run the scrip out of the box such as AppX Packages for the Windows Calculator. We strongly suggest analyzing the tool via the JSON files that include the default settings. This also gives you the opportunity to enable them before running the tool so they remain untouched. I’ll explain more about this later on in the article.

The full list of enhancements for native Windows services will be available soon. Bookmark Run and tune your Remote Desktop Services environment for the latest updates.

Expected performance gains

Azure Virtual Desktop value-added services provider and Microsoft partner LoginVSI performed early tests with the Virtual Desktop Optimization Too and gained over 100 users in their internal benchmarking lab environment with a Windows 10, version 2004 single session. We, therefore, assume that this gain will also be possible with Windows 10 Enterprise multi-session.

VSImax asserts a maximum number of users that are able to log on to the virtual desktop hosts pool as part of the underlying infrastructure. That number is the “sweet spot” as going over that number will decrease performance for all users. (Thanks to LoginVSI for sharing these results with us.)

Note: We recommend you use simulation tools to test your deployment using both stress tests and real-life usage simulations to ensure that your system is responsive and resilient enough to meet user needs Remember to vary the load size to avoid surprises.

Desktops in the Cloud on Performance Optimizations for Azure Virtual Desktop with Robert and Tim (aka VDI Guys)

We recently had the creators of the Virtual Desktop Optimization tool as guests on our Desktops in the Cloud video-podcast. Robert and Tim explained everything you should know, as well as best practices and lessons learned. A must watch in extension to this article. Watch it below. 

How the Virtual Desktop Optimization Tool works

The Virtual Desktop Optimization Tool makes it possible to disable uncommon services for virtual desktop environments, such as Azure Virtual Desktop.

Note: We recommend that you run the script after the Sysprep (System Preparation) process, most likely as startup script w with a large set of virtual machines. This is due to the AppX Packages that conflict and most likely the sysprep will fail. 

Download all the scripts from the public Github repository below –

Click on Clone or Download followed by Download ZIP.

Unzip the folder to your Azure Virtual Desktop – session host(s) – in a random folder (ex. C:\Optimize or C:\Temp).

Note: You could also run the scripts as part of your image management procedure e.g. Azure image Builder (AIB) or Azure DevOps if you like.

Important information before you start running the tool

There are settings default disabled when you run the scrip out of the box such as AppX Packages for the Windows Calculator. We strongly suggest analyzing the tool via the JSON files that include the default settings. This also gives you the opportunity to enable them before running the tool so they remain untouched.

You can find the JSON file in the Windows built number folder, under ConfigurationFiles – e.g. C:\Optimize\2004\ConfigurationFiles. 

You’ve to put the settings to Enabled – that you want to keep as default. Below is the example file for AppX Packages, there are JSON files for Services and scheduled tasks as well. 

Another option is to remove the whole entry out of the JSON file. 

AppxPackages.JSON – Example Windows Calculator App

{
“AppxPackage”: “Microsoft.WindowsCalculator”,
“VDIState”: “Enabled“,
“URL”: “https://www.microsoft.com/e…“,
“Description”: “Microsoft Calculator app”
},

Services.JSON – example Windows Update Service

{
“Name”: “UsoSvc”,
“VDIState”: “Enabled“,
“Description”: “Update Orchestrator service, manages Windows Updates. If stopped, your devices will not be able to download and install the latest updates.”
},

Start PowerShell – Run as Administrator

In PowerShell, change directory to the scripts folder (e.g. C:\Optimize or your own specific folder)

Run the following command to make running possible

Set-ExecutionPolicy -ExecutionPolicy Bypass

Run the VirtualDesktopOptimizationTool steps – by running the command below.

.\Win10_VirtualDesktop_Optimize.ps1 -WindowsVersion 2004 -Verbose

Note: When you use a different build of Windows 10, you must change the WindowsVersion parameter. Build 1803 and up are supported as well for Windows 10 Enterprise. Windows 10 multi-session support applies only to build 2004.

When complete, you should see a prompt to restart.

Reboot the session hosts(s)

Start your Azure Virtual Desktop session

Results out of the performance improvements. As you can see, the number of threads and handles decrease a lot.

Do you have any problems with orphaned Start Menu shortcuts after running the tool?

Have the user open Task Manager, then end the following two processes:

  • ShellExperienceHost.exe
  • StartMenuExperienceHost.exe

Have them check the Start Menu and they should be gone!

Do you have any feedback – or questions about the optimization tool above? Please use our Tech Community platform here to ask questions. 

Happy optimizing! 😊

Let us know your feedback on the tool in the comment section below.

Prefer to watch and learn? There’s also a video on Azure Academy available later this week by Dean Cefola. You can find it here.