UX Series – Improve logon times without impacting the UX

UX Series – Improve logon times without impacting the UX

Hi there, it´s Patrick again, with the third part of the UX Series for Windows Virtual Desktop!

This time I will focus on how to optimize a WVD Session Host for being super performant! We will focus on the solutions available to optimize the Session Host itself and round it up, with using the script as desired state configuration for our existing Session Hosts.

The most of you already know some tools, which perform some optimization tasks like the VM Ware OS Optimization Tool (OSOT) or the Citrix Optimization tool. A comparable solution for RDS or WVD didn´t directly exist. For that reason two Microsoft guys developed a very cool solution, to help you quickly apply optimization on your Session Hosts / images!

Chapter 1: The Optimization Tool

The two Microsoft colleagues Robert M. Smith and Tim Muessig, also known as “the VDI guys” did an awesome job in creating a script to improve the performance on your Windows 10 Session Hosts. This script has been evolved to fit the needs of the recently released Windows 10 2004 MultiSession image, while releasing a PowerShell driven tool to optimize the operating system drastically!

Now we come to the question, what is exactly being modified here?

  • Removing of AppX applications from the system
  • Disabling services, which aren´t needed for the usage in virtualized scenarios
  • Applying default user settings
  • Disabling Scheduled Tasks
  • Set local policies to optimize system

If you want to exactly verify, what the script is doing on your computing resources, just download the tool from the link below, navigate either to the 1909 or 2004 folder and select /ConfigurationFiles/. This is also the place that allows you to modify the script to your needs!

How can you download the script?

Simply visit the GitHub page of the Virtual Desktop Team and Download the repository as ZIP file! You can find the repo here:


Simply click on the green “Code” button and select “Download ZIP”.

Extract the content of the ZIP file to your local hard drive in any preferred location, you would like to use to. In my case I´ve created a folder on my C:\ partition with the name “Optimization” and extracted the content in there.

As a tip from my side, I will move this folder later on to a location more hidden to the end user, because you probably want to execute the script automated, once a new session host is being created to ensure, users will always get the best experience while working on a machine. For this reason I´ve created the folder below:


And I´ve copied the “Optimization” directory to that folder.

Finally the result with the extracted ZIP container should look like this:

You have three different folders, indicating the support for the Windows 10 1909 and 2004 version as well as LGPO, which is a dependency of the tool.

In my next step, I´m going to open the Powershell as an Administrator on my local machine and navigate to the folder, where I´ve recently unpacked the content.

To let the magic happen, I just need to start the script with the proper parameters, please find here how to start with the optimization for

Windows 10 1909:

Set-Executionpolicy -executionpolicy Unrestricted
.\Win10_VirtualDesktop_Optimize.ps1 -WindowsVersion 1909 -Verbose

Windows 10 2004:

Set-Executionpolicy -executionpolicy Unrestricted
.\Win10_VirtualDesktop_Optimize.ps1 -WindowsVersion 2004 -Verbose

Finally start the script, while allowing it to run once, which can be approved by pressing “R” and hit the enter button.

Now, the process of optimization is being started. Let the magic happen (the whole process takes around 5 minutes) and restart your machine.

As I´m in the PowerShell and I want to ensure that my device is properly rebooted, I´ll do it directly via PowerShell using the following commandline:

Shutdown -r -f -t 0

Now we´re heading to the question, when does it make sense to perform these optimization tasks, before installing all required applications or even after performing a SYSPREP?

My opinion is, to apply this script after performing a SYSPREP on the machine and while enrolling the image to the Session Host. The deployment itself might take a few minutes longer, but on the other hand your end users will be presented with a fresh optimized system!

Chapter 2: Automation optimizations in your WVD deployments!

Dean Cefola has optimized the optimization script even more! While he´s extended the script, to just require the execution and all related script files will be immediately being downloaded to the client. We are going to use his script to automate the optimization, once a new Session Host is being provided in our environments.

First, you have to visit his GitHub repository and download the file “WVDOptimize.ps1” to you preferred location on your computer.


Then, login to the Azure Portal, navigate to a Storage Account (or create a new one, if you don´t have yet one).

In my example I´ve named my Storage Account “kcldwestor01”

We click on “Containers” to continue to the Container storage on our storage account and select the container we would like to use. In my example this is “DSC”.

Now you can click on the “Upload” button on the top and select the WVDOptimize.ps1 script you´ve just downloaded from Dean´s repo!

The result should look like this:

The next step will be to run this script as a custom script extension for the Session Hosts. So what we´re going to do is to choose the Session Hosts Virtual Machines, select one of these (in my case KCLD-WVD-AUT-0) and click on extensions. Make sure, that your VM is running while applying the next steps!

Now you just need to click on “+Add” on the top and select “Custom Script Extension” – Click “Create” on the next window.

Now you just need to select the Storage Account, select the script and hit OK. The expected result should be something like this:

You don´t need to enter any Arguments here, just click OK at the bottom and you´re good to go!

Finally you need to reboot the virtual machine to apply the settings and the optimizations to the VM itself.


As some of you are for sure interested in applying the optimization directly at the creation level of a new Session Host, I´m going to prepare something in the near future that will help you to perform this task!

At this stage I can just say thanks to Dean and the team around the VDI guys – extremely good job!

Please follow and like us:

2 Replies to “UX Series – Improve logon times without impacting the UX”