Disconnect a user session in AVD with PowerShell – Azvise While there are ways to forcefully log off idle users (see below), I think it’s important to make your admins aware that disconnected sessions pose a security risk, but also communicate to your users in general that disconnected sessions should be avoided when necessary. Powershell Script to generate … andy2002a Update Disconnect-LoggedOnUsers.ps1. You can set this up though Powershell You can set this up though Powershell PowerShell Disconnect-AzWvdUserSession -ResourceGroupName ResourceGroupName -HostPoolName HostPoolName -SessionHostName SessionHostName -Id 2. The second file is the action script. Furthermore I was able to log back into the server that was disconnected and my apps were still open. It is same script you have now, only add a filter for disconnected so if the user is logged in a second time or if they are connected, it doesn't log the disconnected session off. The 'Get-BrokerSession' cmdlet can be directly used to get a list of the sessions that have been disconnected for at least some target length of time. we still missing this feature in Remote Desktop Service 2012/R2 and later release. PowerShell/Disconnect-LoggedOnUsers.ps1 at master - GitHubHow to Query and Log Off Remote Desktop Sessions with … Logoff a specific user from all servers (useful for password … Use a PowerShell script to force logoff an RDP session