Log off disconnected users from a servers

Photo posted by viavisupport on Feb 18, 2020

Overview

 

command to use in powershell

 

query user /server:$localhost 2>&1 | select -skip 1 | ? {($_ -split "\s+")[-5] -eq 'Disc'} | % {logoff ($_ -split "\s+")[-6] /server:$localhost /V}

Solution Steps

 

command to use in powershell

 

query user /server:$localhost 2>&1 | select -skip 1 | ? {($_ -split "\s+")[-5] -eq 'Disc'} | % {logoff ($_ -split "\s+")[-6] /server:$localhost /V}

Additional Info

Outcomes