Build and Optimize your AVD image

Whether you are building your AVD gold image via Image builder or configuring a virtual machine, optimizing the image and installing any pre-requisites will make the experience much better for the end users. There are many scripts available for this, in this post I’ll run through the one I have made and use.

The script can be found here and I’ll run through the basics of it below:
https://raw.githubusercontent.com/andrew-s-taylor/public/main/Powershell%20Scripts/AVD/avd-box-config-generic.ps1

There is a parameter at the top which simply enables or disables the optimization script, I’d always recommend running it, but the option is there (it defaults to enabled)

There are some standard directory creation, OS detection parts and then the app installs begin:

  1. Enable App-V – I know it’s no longer being developed, but there are many places still using it and enabling it in the build doesn’t do any harm and gives you some options if needed
  2. Enable Screen Capture Protection – Currently only enabled via registry so add this in the build, when it becomes an option in the portal, that can take over
  3. Next runs the AVD optimizer script, credit for this goes to the Virtual Desktop Team (https://github.com/The-Virtual-Desktop-Team/Virtual-Desktop-Optimization-Tool). I found an issue when running it in a Packer environment where the network optimization would kill the NIC on the VM which crashed out Packer and didn’t finish the build. That may be fixed now, but for ease, I removed that section and created a zip of the file without it in (feel free to use either)
  4. Install Chocolatey – This gives us another option for app deployment. Even if you don’t want to use the community packages, you can always host your own Repo and install that way. Plus, you can use a runbook to deploy apps on a schedule: https://raw.githubusercontent.com/andrew-s-taylor/public/main/Powershell%20Scripts/AVD/choco-update.ps1
  5. Install WinGet – Now this has been released, I can only see it gaining momentum so add it into the build now. It grabs the latest release and you can use a runbook similar to choco to install and update apps
  6. Allow RDP shortpath – This gives performance improvements for the end-users, again, once it’s in the portal, I’ll switch to configuring it that way
  7. Finally adds a couple of reg keys for Teams optimization

That’s it, after running you’ll have a nicely optimized build with different app-deployment options. I call this script within Image Builder which utilises POSH GUI and Project Bicep to deploy the entire environment. More on that to follow…

1 thought on “Build and Optimize your AVD image”

Leave a Comment