LC

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

add a comment
0

6 Answers

  • Votes
  • Oldest
  • Latest
IC
shutdown -l

Put that in your batch file. šŸ™‚ Sounds like an insult doesn't it? This assumes XP.

add a comment
0
LC

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

add a comment
0
IC

-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.

add a comment
0
LC

Thanks! I'll give that a try.

ljCharlie

add a comment
0
RX

Hi, sorry to bring back the dead. šŸ˜ 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.

add a comment
0
PA

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.

add a comment
0