how to see list of disconnected users for all hosts?

Jaganljpmail 1 Reputation point
2022-04-15T14:33:18.587+00:00

We have 25 hosts, rather than going to each and every host and check users session status is there a powershell command or an easy way to check list of disconnected/logged off users that get stuck and need to clear manually for them to use their wvd session.

Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,583 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 111.5K Reputation points MVP
    2022-04-19T21:11:42.157+00:00

    Hi @Jaganljpmail ,

    maybe this PowerShell script helps to get started:

    $resourceGroupName = "<your-resourcegroup name>"  
    $hostPoolName = "<your hostpool name>"  
    Get-AzWvdUserSession -ResourceGroupName $resourceGroupName -HostPoolName $hostPoolName | ForEach-Object {  
      Write-Output "UserName: $($_.UserPrincipalName)"  
      Write-Output "Session Status: $($_.SessionState)"  
      Write-Output "Session Host: $($_.Name)"  
    }  
    

    The result will look like this:

    194428-image.png

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.