Azure Virtual Desktop Page

Azure Virtual Desktop Resources (incl. labs)

(updated 04/06/2023 - New labs)

Powershell Script to install FSLogix in a lab environment!

(Take care of the StorageAccount name. You need to change it in line 2!)


$storageAccountName = "NameofStorageAccount" 

#Create Directories

$LabFilesDirectory = "C:\LabFiles"

if(!(Test-path -Path "$LabFilesDirectory")){

New-Item -Path $LabFilesDirectory -ItemType Directory |Out-Null


if(!(Test-path -Path "$LabFilesDirectory\FSLogix")){

New-Item -Path "$LabFilesDirectory\FSLogix" -ItemType Directory |Out-Null


 #Download FSLogix Installation bundle

 if(!(Test-path -Path "$LabFilesDirectory\")){

       Invoke-WebRequest -Uri "" -OutFile     "$LabFilesDirectory\"

 #Extract the downloaded FSLogix bundle

 function Expand-ZIPFile($file, $destination){

     $shell = new-object -com shell.application

     $zip = $shell.NameSpace($file)

     foreach($item in $zip.items()){




 Expand-ZIPFile -File "$LabFilesDirectory\" -Destination "$LabFilesDirectory\FSLogix"


   #Install FSLogix

   if(!(Get-WmiObject -Class Win32_Product | where vendor -eq "FSLogix, Inc." | select Name, Version)){

       $pathvargs = {C:\LabFiles\FSLogix\x64\Release\FSLogixAppsSetup.exe /quiet /install }

       Invoke-Command -ScriptBlock $pathvargs


   #Create registry key 'Profiles' under 'HKLM:\SOFTWARE\FSLogix'

   $registryPath = "HKLM:\SOFTWARE\FSLogix\Profiles"

   if(!(Test-path $registryPath)){

       New-Item -Path $registryPath -Force | Out-Null


   #Add registry values to enable FSLogix profiles, add VHD Locations, Delete local profile and FlipFlop Directory name

   New-ItemProperty -Path $registryPath -Name "VHDLocations" -Value "\\$\userprofile" -PropertyType String -Force | Out-Null

   New-ItemProperty -Path $registryPath -Name "Enabled" -Value 1 -PropertyType DWord -Force | Out-Null

   New-ItemProperty -Path $registryPath -Name "DeleteLocalProfileWhenVHDShouldApply" -Value 1 -PropertyType DWord -Force | Out-Null

   New-ItemProperty -Path $registryPath -Name "FlipFlopProfileDirectoryName" -Value 1 -PropertyType DWord -Force | Out-Null

   #Display script completion in the console

   Write-Host "Script Executed successfully"

Example Script for LogAnalytics Queries


|sort by TimeGenerated asc, CorrelationId

 |summarize Connectcount = dcount(CorrelationId) by bin(TimeGenerated, 1d),UserName = toupper(trim_end("@.*",UserName))

Microsoft VDI Teams own Powershell Script to Optimize VDI Images

Automatic Scaling (how to and script)

AVD Client Cleanup (Script)

Image Customization Script (with GUI)

Script it self WVD/Image-Build/Customizations at master · shawntmeyer/WVD (

Automatic Download via this link: DownGit (