(Windows) Virtual Desktop Optimization Tool now available

Microsoft

Christiaan_Brinkhoff_0-1596206475321.png

 

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 Windows Virtual Desktop.

 

Note: The information in this post is community-driven; nothing has yet been officially launched by the Windows 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 Windows 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.

 

Christiaan_Brinkhoff_1-1596206475330.png

 

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 Windows 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

Windows 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.)

 

Login_VSI_Blog_MSFT_Optimizer_Image_4.png

 

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 Windows 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 to use the Virtual Desktop Optimization Tool

The Virtual Desktop Optimization Tool makes it possible to disable uncommon services for virtual desktop environments, such as Windows 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. 

 

  1. Download all scripts from the Virtual-Desktop-Optimization-Tool GitHub repository.
  2. Select Clone or download, followed by Download ZIP.

    Christiaan_Brinkhoff_3-1596206475342.png

Unzip the folder to your Windows Virtual Desktop session host(s) to a specified folder (e.g. 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.

Christiaan_Brinkhoff_4-1596206475347.png

Important information before running the tool

 

  1. 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.

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

  3. 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.

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

     

    AppxPackages.json - Example Windows Calculator App

      {
        "AppxPackage": "Microsoft.WindowsCalculator",
        "VDIState": "Enabled",
        "URL": "https://www.microsoft.com/en-us/p/windows-calculator/9wzdncrfhvn5",
        "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."
      },

 

 

  1. Prepare to launch Windows PowerShell and select Run as Administrator.

    Christiaan_Brinkhoff_5-1596206475350.png

  2. In PowerShell, change the directory to the folder to which you downloaded the scripts, e.g. C:\Optimize or your own specific folder.

    Christiaan_Brinkhoff_6-1596206475351.png

  3. Run the following command:
    Set-ExecutionPolicy -ExecutionPolicy Bypass ​

    Christiaan_Brinkhoff_7-1596206475352.png

  4. Run the Virtual Desktop Optimization Tool using the following command:
    .\Win10_VirtualDesktop_Optimize.ps1 -WindowsVersion 2004 -Verbose​

    Christiaan_Brinkhoff_8-1596206475356.png
    Note: When you use a different version of Windows 10, you must change the WindowsVersion parameter. Version 1803 and later are supported for Windows 10 Enterprise. Windows 10 multi-session support is only available with Windows 10, version 2004 and later.

  5. Select Yes when prompted to reboot the session hosts(s).
  6. Start your Windows Virtual Desktop session.

    Christiaan_Brinkhoff_9-1596206475359.png

     

As you can see in the Task Manager comparison below, the number of threads and handles has decreased noticeably after running the Virtual Desktop Optimization Tool.

Christiaan_Brinkhoff_10-1596206475379.png

 

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.

 

2020-08-01 09_24_22-Window.png

 

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.

 

40 Replies

I think this article did not do justice in terms of spelling out what the optimizer does. I was not expecting it to remove more  Windows 10 AppX packages.

@Christiaan_Brinkhoff 

More documentation on what happens is coming online (hopefully) next week as referred to in the article.

Nice work! Was testing the script for a while already and implmenting it to production at the moment.

 

I did several customizations for my needs:

- Used 

$((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId) to get the acurate Windows version
- Removed the *.log deletion at line 223 (we need logs!)
- Removed the reboot warning/config at the end of the script (want to run unattended)
- Adjusted AppXPackages.json, don't want all AppX packages get removed
- Adjusted Autologgers.json, removed the RadioMgr part (gave an error)
 
Please consider to built in something for customization like in the Citrix Optimizer. 
 
After removal of the AppX packages, users with an existing profile got a lot of orphaned shortcuts in their startmenu, is there a solution for this?
 

2020-08-01 09_24_22-Window.png

Hello @WVD_Learner88 ,

 

We have published a document on optimizing Windows 10, 1909, here:

 

https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds_vdi-recommendatio...

 

We have a new version for 2004 that is in publication review at the moment.

 

There are several changes from milestone to milestone, but much of the information is pertinent to Windows 10 2004.  The scripts are designed to be easily customized.  There are sections of work in the .JSON input files, such as removing the Appx packages that are not going to be used in a particular environment.  If there are apps that you do not wish to be removed, you can edit the .JSON file to remove the entry for the app you wish to keep.

 

For example, if you wish to keep the Weather app, you would go to the appropriate folder for your Windows 10 build, (ex. \2004), then go to the 'ConfigurationFiles' subfolder (ex. \2004\ConfigurationFiles), then edit the input file 'AppxPackages.json'. in one of two ways:

 

  1. Change the value of 'VDIState' to "enabled":
    1. Locate the block of JSON code with the text "AppxPackage": "Microsoft.BingWeather"
    2. Within that block of JSON code, change the value of 'VDIState' from "disabled" to "enabled"
  2. Delete out the entire block of code for the Weather app:
    1. Locate the block of JSON code with the text "AppxPackage": "Microsoft.BingWeather"
    2. Delete out all of the following code, including the trailing comma, then save the changes locally:

 

  {
    "AppxPackage": "Microsoft.BingWeather",
    "VDIState": "Disabled",
    "URL": "https://www.microsoft.com/en-us/p/msn-weather/9wzdncrfj3q2",
    "Description": "MSN Weather app"
  },

 

For either method, test to ensure you receive the results you expect.  Most of the time I test on my local device using a local virtual machine, that has been checkpointed to the time just after the initial installation.  That way it is easy and only takes seconds to roll back to that point after a test.

 

I hope this information is helpful.

 

Thanks,

 

Robert M. Smith

 

 

Hello @FreekBloemhof ,

 

To prevent changes to existing user profiles on virtual desktop, either do not apply to session hosts that host local profiles, or modify the input file 'Appxpackages.json' and change the value 'VDIState' to "enabled" for each app you wish to keep.  For example to keep the Sticky Notes app, change this:

 

  {
    "AppxPackage": "Microsoft.MicrosoftStickyNotes",
    "VDIState": "Disabled",
    "URL": "https://www.microsoft.com/en-us/p/microsoft-sticky-notes/9nblggh4qghw",
    "Description": "Notetaking app"
  },

 

to this (for Stick Notes as an example):

  {
    "AppxPackage": "Microsoft.MicrosoftStickyNotes",
    "VDIState": "Enabled",
    "URL": "https://www.microsoft.com/en-us/p/microsoft-sticky-notes/9nblggh4qghw",
    "Description": "Notetaking app"
  },

 

To fix the existing profiles, you should be able to reinstall the app(s) from the Store app, which is not removed because it is real difficult to get back.  You can go through the Appx input file and you can find the URL to each app in the input file.

 

I hope this is helpful.

 

Thanks,

 

Robert M. Smith

@Christiaan_Brinkhoff  In time can you post a link to all the tweak's its doing? I would like to compare this with "Citrix Optimizer"

Thank you.

@Robert_Smith thanks for the information here about the Appx packages but I don't think you answer the question about how we can clean up these leftover artifacts in the case where we DO want to remove these apps but local user profiles already exist on the session host. Is there no way to do this?

Thanks for sharing your information. it's look great help https://bloginpk.com

@Christiaan_Brinkhoff Great to see that MS is helping the customers to optimize Windows 10 in a virtualized environment. It would be nice to get official support by Microsoft for using optimization tools like this. It would be even nicer to be able to deploy an optimized Window 10 image out of the box :-).

2 remarks:

- Feature request: to be able to select optimizations. Now it's all or nothing.

- In the current version, there is an optimization that disables the inline videos in Internet Explorer. This will artificially increase the Login VSI results, because playing videos from a browser is one of the tasks in the Login VSI workload. 

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main]
"Display Inline Videos"="no"

@Christiaan_Brinkhoff 

 

Question about the note on recommendations to run this "post sysprep".

 

Nagorg-Tridius_0-1597148222727.png

Can you expand on this?  This implies that at least some of the optimizations may be undone after deployment of a generalized VM.  Is that the reason for this recommendation? 

 

Ideally there would be no need to further optimize your VM deployed from a master image.

FWIW, tread lightly with this tool!  My initial attempt running this left me with things broken such as OneDrive for example.

Perhaps this tool should be run against the reference VM BEFORE installing apps?  That way maybe OneDrive wouldnt break?  Dunno but my first experience says that much more lab time is needed before applying this to systems intended for deployment to production host pools!
YMMV...

@Robert_Smith   

 

I'm trying to reinstall the snip & sketch tool from the MS Store, but get the message 'Try again later. Something happened at our end. '  

@Robert_Smith thanks for your reply, but I already found that out. It is lijke @Roger1175 says. We have a list of orphaned shortcuts in the startmenu for existing users (with an FSLogix profile). 

 

I would like to remove those shortcuts/apps without resetting the profile of the users.

 

What I also noticed, Windows Search is beeing disalbed. From optimizing point of view I kinda get this, but it decreases the user experience a lot on Windows 10. 

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

 

  • ShellExperienceHost.exe
  • StartMenuExperienceHost.exe

Have them check the Start Menu and let us know the results.

Nice work, it is alway welcomed to have an Windows 10 LTSC/ Windows Server 2019 like exeperience, this script and others Microsoft/Citrix recommendations helped us alot to improve the performance of WVD.

 

@Christiaan_Brinkhoffcan you explain what is going on with Wsearch service?

One of our main performance bottleneck is the Wsearch index performance and outlook in multi session environnement.

 

1909 recommandations is to not enable Windows Search: https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds_vdi-recommendatio...

 

2004 recommandations according to this script is to let it unchanged. (Auto-Start)

https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool/commits/master/2004

 

d Some people started to force back Windows Search per machine using multiple tweaks: https://social.msdn.microsoft.com/Forums/en-US/a9b5000d-e2a8-442b-9cbf-48e05136f732/support-for-serv...

 

We are using th default settings Windows Search per users and we had many issues last weeks with the Outlook Build 12527.20880, the index got crazy on large Outlook profiles causing kernel loops. We had to rollback multiples servers to Build 11929.20838.

We are planning to upgrade our customers to Windows 2004 and Office Build 12527.20988 which seem to fix performances issues https://docs.microsoft.com/en-us/officeupdates/semi-annual-enterprise-channel#version-2002-august-11

 

What are your recomendations, should we disable the service after the upgrade?

@FreekBloemhof I have a tool that has repaired the Start Menu for another customer and does not removed user pinned items from their Start Menu.  Save the following as a batch file and have the user run this (does not require elevation):

 

start /wait taskkill /IM StartMenuExperienceHost.exe /F
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\AC"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\AppData"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalCache"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\RoamingState"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\Settings"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\SystemAppData"
rd /S /Q "%UserProfile%\Appdata\Local\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\TempState"
Start C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\StartMenuExperienceHost.exe

@Christiaan_Brinkhoff Great article, thank you very much!  Like others I was looking for guidance on when (and where) to run it, since you don't recommend running it before sysprep.  Do you suggest local GPEdit startup script, or another way,?

 

Thank you so much!

 

Garth

When can we expect a 20H2 refresh of the tool?