Avatar of CCFD1Bill
CCFD1Bill

asked on 

Remotely log a user off a Windows XP machine

We have many computers that are used by multiple people and occasionally someone locks their PC when they leave and the next user can't log in.  Right now, we'd have to either reboot the PC or log in and then log off it can be used again.  Wondering if there is a simple command line prompt that will do such a thing.  We use shutdown -r -m \\computername to reboot a PC but is there something like logoff \\computername that will log the user currently on that computer off?
Microsoft DOSWindows XP

Avatar of undefined
Last Comment
CCFD1Bill
Avatar of Daniel Van Der Werken
Daniel Van Der Werken
Flag of United States of America image

Will Shutdown work?
c:\>shutdown /?




Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

        No args                 Display this message (same as -?)
        -i                      Display GUI interface, must be the first option
        -l                      Log off (cannot be used with -m option)
        -s                      Shutdown the computer
        -r                      Shutdown and restart the computer
        -a                      Abort a system shutdown
        -m \\computername       Remote computer to shutdown/restart/abort
        -t xx                   Set timeout for shutdown to xx seconds
        -c "comment"            Shutdown comment (maximum of 127 characters)
        -f                      Forces running applications to close without warning
        -d [u][p]:xx:yy         The reason code for the shutdown
                                u is the user code
                                p is a planned shutdown code
                                xx is the major reason code (positive integer less than 256)
                                yy is the minor reason code (positive integer less than 65536)

Open in new window

sorry.  I didn't see that you already use shutdown.
Avatar of CCFD1Bill
CCFD1Bill

ASKER

Yeah, the -l (log off) won't work with the -m (that specifies the computer name).
ASKER CERTIFIED SOLUTION
Avatar of yobri
yobri
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of brutaldev
brutaldev
Flag of South Africa image

Because you can't use SHUTDOWN to log off a user remotely, you can to run the command as if you were on the machine. The utility of choice to do this is PsExec. To execute the logoff on the remote machine use something like this:
 
PsExec.exe \\computername -u "remoteusername" -p "remotepassword" shutdown -l -f

Open in new window

This will execute SHUTDOWN as if you were the logged on user on that machine.
Avatar of CCFD1Bill
CCFD1Bill

ASKER

I'll check those out but, optimally, would like a solution that doesn't require an install.
Avatar of brutaldev
brutaldev
Flag of South Africa image

PsExec and PsShutdown are stand alone executables with no dependencies, no install, just have it in your path to execute it from command prompt.
Avatar of yobri
yobri
Flag of United States of America image

Yes, excellent (or super excellent) administrator tools to have which are obtained from the Microsoft site.
Avatar of CCFD1Bill
CCFD1Bill

ASKER

Since we don't always know the user's password to use psexec.exe, psshutdown did the trick.  Thanks!
Windows XP
Windows XP

Microsoft Windows XP is the sixth release of the NT series of operating systems, and was the first to be marketed in a variety of editions: XP Home and XP Professional, designed for business and power users. The advanced features in XP Professional are generally disabled in Home Edition, but are there and can be activated. There were two 64-bit editions, an embedded edition and a tablet edition.

119K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo