In the last few days, we had an issue at a customer where session hosts were showing as Available, sessions were on them, but no users could connect to them anymore. So they were available first, users could log in. After some time the sessions were disconnected, but the sessions were still present.
Logging off users like connecting via RDP was not possible.
The customer has session hosts in different regions.
After some time the customer found out together with Microsoft support that the version of the SxSStackListener was faulty.
Microsoft now wants to roll back the version rdp-sxs230307400 in the background.
Unfortunately the version of the SxSStackListener is not shown at any place. I have now created a PowerShell script that can be used to check the version on the session hosts across all host pools. A list is compiled which can be further processed and filtered as desired.
I hope the script can help one or the other to check the versions of the agents, even if there is no problem with this SxSStackListener version later.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# Author: Stefan Beckmann # Version: 1.0 # Date: 2023-05-19 # Description: This script will check the SxSStackVersion of all Session Hosts in all Host Pools in a WVD Tenant and output the result to a CSV file # Check if Module is installed and if not install it if (!(Get-Module -Name Az.DesktopVirtualization -ListAvailable)) { Install-Module -Name Az.DesktopVirtualization -AllowClobber -Force } # Checo if the module is imported and if not import it if (!(Get-Module -Name Az.DesktopVirtualization)) { Import-Module -Name Az.DesktopVirtualization } # Check if the user is logged in and if not log in if (!(Get-AzContext)) { Connect-AzAccount } # Create an empty array to store the output $outPut = [System.Collections.ArrayList]@() # Get all Subscriptions $subscriptions = Get-AzSubscription # Loop through all Subscriptions and get all host pools $hostPools = [System.Collections.ArrayList]@() ForEach ($subscription in $subscriptions) { $subscriptionName = $subscription.Name $null = Set-AzContext -SubscriptionName $subscriptionName # Get all Host Pools and add them to the array Get-AzWvdHostPool | ForEach-Object { $null = $hostPools.Add($_) } } # Loop through all Host Pools ForEach ($hostPool in $hostPools) { $hostPoolName = $hostPool.Name $resourceGroupName = $hostPool.Id.Split('/')[4] $subscriptionId = $hostPool.Id.Split('/')[2] # Get all Session Hosts $sessionHosts = Get-AzWvdSessionHost -SubscriptionId $subscriptionId -ResourceGroupName $resourceGroupName -HostPoolName $hostPoolName # Loop through all Session Hosts ForEach ($sessionHost in $sessionHosts) { # Create an object for each Session Host $title = 'Microsoft.DesktopVirtualization/SessionHosts/Status' $object = [PSCustomObject]@{ SessionHostName = $sessionHost.Name.Split('/')[1] ResourceGroupName = $resourceGroupName HostPoolName = $hostPoolName Status = $sessionHost.Status AgentVersion = $sessionHost.AgentVersion SxSStackVersion = $sessionHost.SxSStackVersion LastHeartBeat = $sessionHost.LastHeartBeat LastUpdateTime = $sessionHost.LastUpdateTime UpdateState = $sessionHost.UpdateState } $object.PSTypeNames.Insert(0, $title) $null = $outPut.Add($object) } } # Output the result #$outPut | Export-Csv -Path './WVD-SessionHosts.csv' -NoTypeInformation #$outPut | Where-Object {$_.SxSStackVersion -eq 'rdp-sxs230307400'} | Export-Csv -Path './WVD-SessionHosts.csv' -NoTypeInformation $outPut | Where-Object { $_.SxSStackVersion -eq 'rdp-sxs230307400' } | Select-Object SessionHostName, SxSStackVersion |
1 thought on “Session host can no longer be connected”
Comments are closed.