Batch file to force user to log off

  • ljCharlie
  • Proficient
  • Proficient
  • ljCharlie
  • Posts: 343

Post 3+ Months Ago

Anyone know a way to force user to log off via batch file? Here's what I want to do. I want the user to log on to a workstation or server, once they logged in a script will run automatically. Once the script has run, I want to force the user to log out of the server or workstation.

Any suggestion is appreciated.

ljCharlie
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • icyroadz
  • Student
  • Student
  • User avatar
  • Posts: 66
  • Loc: Edmonton, Alberta, Canada

Post 3+ Months Ago

Code: [ Select ]
shutdown -l


Put that in your batch file. :) Sounds like an insult doesn't it? This assumes XP.
  • ljCharlie
  • Proficient
  • Proficient
  • ljCharlie
  • Posts: 343

Post 3+ Months Ago

Thanks for the response. What is the -1 means? I don't want to shutdown the server. I just want the user to be forced to logoff.

ljCharlie
  • icyroadz
  • Student
  • Student
  • User avatar
  • Posts: 66
  • Loc: Edmonton, Alberta, Canada

Post 3+ Months Ago

-L is a "dash" then an "L" for logoff. That code font makes it look like a 1. lol
:)
In a command prompt you can just type "shutdown" and it'll give you the options that go along with it. For example, "shutdown -s" actually will shutdown your PC.
  • ljCharlie
  • Proficient
  • Proficient
  • ljCharlie
  • Posts: 343

Post 3+ Months Ago

Thanks! I'll give that a try.

ljCharlie
  • renegade X
  • Born
  • Born
  • renegade X
  • Posts: 3

Post 3+ Months Ago

Hi, sorry to bring back the dead. :D This is the best result from google (many links I have went through).

My boss refuses to let me link a gpo to our users OU, so I created a batch file to restart some computers. I would like to use shutdown -l, but this does not run in a batch file. Is there a missing switch?

Edit: Sorry this works in a batch file, but only for a local computer, I would like to know how to batch this over rpc.
  • patspidy
  • Born
  • Born
  • patspidy
  • Posts: 1

Post 3+ Months Ago

just in case anyone else has run into a similar problem:

Server 2003 environment with thin clients as workstations. I have a particular thin client setup to run specific programs upon logon (active directory, environment tab). As such, they need to logoff once a day so the program can shut down gracefully and then log back on to start the programs back up again. I created a batch file that accomplishes all of this at once. Run the batch file as soon as the user logs on.

@echo off
sleep 20
cd "C:\Program Files\Test\"
start /max test.exe
sleep 86100
tskill test
sleep 5
shutdown -l

The thin client uses RDP to connect and the connection is set to auto logon.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.