Introduction
During our latest Citrix project, we implemented Citrix DaaS Standard for Azure, to provide GPU powered Azure CAD workstations with AutoDesk 2023. One of the challenges to solve, was AutoDesk sessions persistence, so an engineer wouldn’t have to authenticate to AutoDesk over and over again.
AutoDesk provides a knowledge base article, about how this can be solved manually in a Citrix Golden Master Image. The solution is to create a Microsoft KM-TEST Loopback Adapter in the Golden Master Image.
For this project, we decided to create the Golden Master Image through a combined Azure DevOps + Packer approach. So we needed to translate this support article into PowerShell.
Research
1. I started by searching, if this has already been achieved. I found an old article from social.technet.microsoft.com where this issue was already discussed:
How to programatically add and configure loopback adapter? (social.technet.microsoft.com)
2. Then I had to research, how to get access to a devcon.exe or devcon64.exe to create the adapter itself. I stumbled across this GitHub project, but did not understand how to use it. Luckily, I found a comment in the issues, that solved my problem to get access to the exe file:
Drawbackz / DevCon-Installer | Please update a version for windows 10 21H2 #6 (github.com)
3. I had to find out, how to disable the connections’ address registration in DNS. I found the solution to this question in the comments of the following blog:
How to Set DNS Suffix and Registration using PowerShell (boriskagan.net)
4. Last but not least, I want to disable all the interfaces’ bindings except IPv4. This was described in Microsoft’s documentation about the command Set-NetAdapterBinding
:
Set-NetAdapterBinding (learn.microsoft.com)
Script
The combination of this research led to the following script:
# PowerShell Wrapper for Packer - (C)2023 Marco Hofmann@anaxco.de # Example 1: Start-Process "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru # Example 2 Powershell: Start-Process powershell.exe -ExecutionPolicy bypass -file $Destination # Example 3 EXE (Always use ' '): # $UnattendedArgs = '/qn' # (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode # Example 4 MSI (Always use " "): # $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" # (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode $Vendor = "Microsoft" $Product = "KM-TEST Loopback Adapter" $Version = "1.0" $PackageName = "devcon64" $InstallerType = "exe" $Source = "$PackageName" + "." + "$InstallerType" $Uri = "https://" + $env:storageaccountname + ".blob.core.windows.net/" + $env:storageaccountcontainer + "/" + $Source + "?" + $env:storagecontainerkey Write-Host "##[group]Installation $Vendor $Product $Version" Set-Location -Path $env:downloadcache Write-Host "##[command]Downloading $Vendor $Product $Version" $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Source $ProgressPreference = 'Continue' Write-Host "##[command]Starting Installation of $Vendor $Product $Version" Move-Item -Path "$env:downloadcache\$Source" -Destination "$env:windir\system32\" -Force Write-Host "##[command]Customization of $Vendor $Product $Version" # Install the Microsoft KM-TEST Loopback Adapter devcon64.exe -r install $env:windir\Inf\Netloop.inf *MSLOOP # Rename the Microsoft KM-TEST Loopback Adapter NIC to "Loopback" Get-NetAdapter -InterfaceDescription 'Microsoft KM-TEST Loopback Adapter' | Rename-NetAdapter -NewName 'Loopback' # Set the metric to 254 Set-NetIPInterface -InterfaceAlias 'Loopback' -InterfaceMetric 254 # Set the "Register this connection's address in DNS" to unchecked Get-NetAdapter -InterfaceDescription 'Microsoft KM-TEST Loopback Adapter' | Set-DnsClient -RegisterThisConnectionsAddress:$false # Disable bindings Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_msclient' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_pacer' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_server' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_tcpip6' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_lltdio' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_rspndr' -Enabled:$false Set-NetAdapterBinding -Name 'Loopback' -ComponentID 'ms_lldp' -Enabled:$false Write-Host "##[endgroup]"
Which results in the following adapter (German OS):
Conclusion
I hope this has been helpful for you! Feel free to leave me a comment!
Hi Macro,
Very interesting post.
I do have a couple of questions tho as I’m trying to make CAD in azure working.
At the moment we are using AVD, but we are coming from a Citrix farm on premises what I’m managing.
We figured out with Microsoft that the RDP protocol couldn’t handle it. When the GPU acceleration is enabled we would get color distortion, flickering of lines in a CAD file or when moving around the screen wouldn’t fully update and part of the drawing would stick on the screen for a couple of miliseconds. If we disabled the GPU acceleration, then we have a lot of frame drops.
So, I’m wondering, What windows 10 version are you running? Single session or multi session?
Also what sku are you using? And do you have the GPU encoding enable?
And most importantly, how is the user experience? Do you also have some distortion or compression on screen?