·

Disconnect a user session in Azure Virtual Desktop (AVD) – PowerShell

This note is from

: some names or features may have changed.

Prerequisites: The Microsoft.RDInfra.RDPowerShell module, the Az PS module

First, install the RDInfra module:

Install-Module -Name Microsoft.RDInfra.RDPowerShell; Import-Module -Name Microsoft.RDInfra.RDPowerShell

Then proceed by installing the Az module and logging in:

Connect-AzAccount

Once you are logged in you can run the following script to disconnect a specific user session:

Get-RdsUserSession -TenantName "tenantname.onmicrosoft.com" -HostPoolName "HostPoolName" | where { $_.UserPrincipalName -eq "azvise\demouser" } | Invoke-RdsUserSessionLogoff -NoUserPrompt

One response to “Disconnect a user session in Azure Virtual Desktop (AVD) – PowerShell”

  1. […] Disconnect a user session in Azure Virtual Desktop (AVD) – PowerShell […]

Discover more from Azvise

Subscribe now to keep reading and get access to the full archive.

Continue reading