Force logoff terminal users

Using PowerShell

To log off all user sessions, run the following Powershell cmdlets on the Connection Broker:

PowerShellCopy

$sessions = Get-RDUserSession

foreach($session in $sessions)
{
    Invoke-RDUserLogoff -HostServer $session.HostServer -UnifiedSessionID $session.UnifiedSessionId -Force
}