@echo off
color 0a
title Logging off Disconnected RDP(s) . . . . .
cls
::Disconnected user logoff
for /f "tokens=2 delims= " %%a in ('query user ^| findstr Disc') do for %%b in (%%a) do (echo %~n0 script is logging off session id - %%a logoff %%a)
::Active user logoff
for /f "tokens=3 delims= " %%a in ('query user ^| findstr Active') do for %%b in (%%a) do (echo %~f0 is logging off session id - %%a logoff %%a)
title Logging off RDP(s) Complete . . . . .
exit
*Note - You must have administrator privileges.
color 0a
title Logging off Disconnected RDP(s) . . . . .
cls
::Disconnected user logoff
for /f "tokens=2 delims= " %%a in ('query user ^| findstr Disc') do for %%b in (%%a) do (echo %~n0 script is logging off session id - %%a logoff %%a)
::Active user logoff
for /f "tokens=3 delims= " %%a in ('query user ^| findstr Active') do for %%b in (%%a) do (echo %~f0 is logging off session id - %%a logoff %%a)
title Logging off RDP(s) Complete . . . . .
exit
*Note - You must have administrator privileges.
No comments :
Post a Comment