How to Optimize Windows 10 VDI for Improved Performance and Density

The global health pandemic has forced organizations to move rapidly to a remote work model. Not only has it been necessary to quickly find solutions to let employees work remotely but it has also required IT departments to get more out of existing solutions, like virtual desktop infrastructure (VDI) and Windows Virtual Desktop (WVD). In this article, we’ll look at a rebranded tool from Microsoft’s ‘The VDI guys‘ that you can use to optimize Windows 10 virtual machines (VM).

Windows 10 Optimizer is rebranded Virtual Desktop Optimization Tool

The Virtual Desktop Optimization tool is not completely new, but it is a rebranded version of the Windows 10 Optimizer written by Microsoft’s Robert M. Smith and Tim Muessig (The VDI guys). The tool works with multi and single-session deployments in Windows Virtual Desktop. And it supports Windows 10 versions 1909 and 2004 at the time of writing this article.

It’s worth noting that while the tool was developed by Microsoft employees, it is not an official Microsoft product. As such, it is not supported by Microsoft. Although it is possible that sometime in the future that the tool might get an official release by the Windows Virtual Desktop team.

Using the Virtual Desktop Optimization Tool

The optimization tool is provided as a free PowerShell script. You can download it from GitHub here. Many of the optimizations performed by the tool are outlined in an article on Microsoft’s website: Optimizing Windows 10, version 1909, for a Virtual Desktop Infrastructure (VDI) role. The tool performs various optimizations including:

  • Removes inbox Microsoft Store (UWP) apps
  • Disables schedules tasks
  • Stops some services and disables others
  • Network optimizations
  • Removes temporary files and logs not in use
  • Clears Recycle Bin and Branch Cache

Like any configuration changes to Windows, you must test the optimization script to make sure that it doesn’t cause operational issues or compatibility problems with line-of-business applications. While there isn’t yet a full list of the changes the script makes, Microsoft is planning to publish a full list of the optimizations for native Windows system services on its site here.

Download and run the Virtual Desktop Optimization Tool

The script should be used only after sysprep is run to generalize your Windows image. If you have many images that need optimizing, you can configure the script to run as a Group Policy ‘startup’ script. Follow the instructions below to run the script on your Windows 10 image.

  • Download the script from GitHub by clicking the green Code button and then click Download ZIP.
Image #1 Expand
Figure1 2
How to Optimize Windows 10 VDI for Improved Performance and Density (Image Credit: Russell Smith)

 

  • Extract the contents of the zip file.
  • Move the extracted folder to the root of your c:\ drive.
  • Rename the extracted folder to Optimize.
  • Open Windows PowerShell with local administrator privileges.
  • Now run the commands shown below in the PowerShell window. Here’s an explanation of what each command does:
    1. The first command, change directory (cd), changes the working directory to c:\optimize.
    2. Set-ExecutionPolicy is used to temporarily disable PowerShell’s execution policy because the script isn’t digitally signed. When you close the PowerShell session, the execution policy will be reverted to its previous setting.
    3. The optimization script is run on Windows 10 version 2004 (May 2020 Update). And the -Verbose parameter is used to display a full log in the terminal window of the changes made by the script.
    4. When the script has finished running, restart the computer.
cd c:\optimize
Set-ExecutionPolicy -ExecutionPolicy ByPass
.\Win10_VirtualDesktop_Optimize.ps1 -WindowsVersion 2004 -Verbose
Restart-Computer -Force
Image #2 Expand
Figure2 1
How to Optimize Windows 10 VDI for Improved Performance and Density (Image Credit: Russell Smith)

Benchmarking

In my unscientific before and after comparison, you see that in the figure below, the device now runs with many less threads, processes, and open handles (right image) than before the tool was run (left image).

 

LoginVSI has published a more thorough test of how running the optimization script affects performance. Using VSImax, which calculates a ‘sweet spot’ number of users that can log in to a host pool without degrading performance for all users, LoginVSI was able to increase the number of Windows 10 version 2004 sessions from 153 to 249. For the full set of results, check out LoginVSI’s blog here.

Image #3 Expand
Figure5
How to Optimize Windows 10 VDI for Improved Performance and Density (Image Credit: LoginVSI)

Increase VM density using the optimization script

The optimization script takes just 5 to 10 minutes to run. It reduces the overhead required to run Windows 10, so it is worth looking into because you can increase the number of VMs hosted (VM density) by your VDI. Other tools, like Citrix Optimizer and VMware OS Optimization Tool (OSOT) can also be used to optimize Windows 10 for VDI.