Thursday, February 3, 2022

Logoff Disconnected Users with 1 line of PowerShell

 This is the simple way to logoff disconnected users with 1 line of PowerShell


########################################################
# Script to log off Disconnected users on local users
# Ref: https://searchenterprisedesktop.techtarget.com/blog/Windows-Enterprise-Desktop/Logoff-Disconnected-Win10-Users-Via-Command-Line
# Ref Post By: Ed Tittel 24 Sep 2018
#######################################################
# Larry Billinghurst - 3 Feb 2022
#######################################################

quser | Select-String "Disc" |ForEach {logoff ($_.tostring() -split ' +')[2]}






No comments:

Post a Comment