4/16/2009

LOGOFF Remote users and administrators

Use it when you want to logoff a remote admin because you hate using the Windows Terminal Services Console or because sometimes it crashes. Functions in Windows Server 2003.

The syntax for these exercise:

C:\Administrator>psexec \\192.168.0.2 -u testing\administrator cmd

PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com

Password: ********

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\WINDOWS\system32>query session

SESSIONNAME USERNAME ID STATE TYPE DEVICE
>console Administrator 0 Active wdcon
rdp-tcp 65536 Listen rdpwd
rdp-tcp#4 Spiderman 1 Active rdpwd
rdp-tcp#5 Superman 2 Active rdpwd

C:\WINDOWS\system32>logoff 1

C:\WINDOWS\system32>logoff 2

And here you have the LAB, clic the image to enlarge:



Somebody will ask to logoff users in worksations, well we are here with psexec, but as a preview for the psshutdown tool, this script forces the remote opened applications to close and proceeds with the logoff of the console user:

>psshutdown \\MarketingPC -f -o

1 comment:

Anonymous said...

Thank you, this was by far the easiest way i have found to check who is logged in and log them off.

Kind of like ssh :)