Command line logoff, not reboot

  • Thread starter Thread starter Michael Lueck
  • Start date Start date
M

Michael Lueck

Is there a command line tool that could be used in a batch script to log the user off the desktop back to Ctrl-Alt-Del login screen?

TIA!
 
Hi Michael,
Michael said:
Is there a command line tool that could be used in a batch script to
log the user off the desktop back to Ctrl-Alt-Del login screen?

what do you think the meaning of logoff.exe is?
Should be located in system32 folder.
Best greetings from Germany
Olaf
 
Olaf Engelke said:
Hi Michael,


what do you think the meaning of logoff.exe is?
Should be located in system32 folder.
Best greetings from Germany
Olaf

Hallo Olaf,
what makes you that shure, he is using windows xp or newer ?
w2k and I think also nt have no logoff.exe
 
Hi Matthias,
Matthias said:
what makes you that shure, he is using windows xp or newer ?
w2k and I think also nt have no logoff.exe

you may be right. At least I had it on my Windows 2000 Server (don't have a
workstation run here).
If he doesn't have the NT Server Resource kit somewhere, Michael can get it
also from here:
http://www.microsoft.com/ntserver/nts/downloads/recommended/ntkit/default.asp
since the tool is included in that package.
Best greetings from Germany
Olaf.
 
Matthias said:
Hallo Olaf,
what makes you that shure, he is using windows xp or newer ?
w2k and I think also nt have no logoff.exe

Ja, das is correct... this is a win2000 group after all! ;-) I know, M$ trying to make everyone believe there is no need for a command promp did not make such a group as thus under the WinXP groups.

I'll check the Win2K RK CD I have, or the online thing.

I had tried the PSShutdown which I use for reboots, it had a -o which said something about logging off the desktop, but alas it rebooted the box.
 
In notepad type this.

CONST LOGOFF = 0
CONST SHUTDOWN = 1
CONST REBOOT = 2
CONST FORCE = 4
CONST POWEROFF = 8
For each objpc in getobject("winmgmts:
{(shutdown)}").execquerry("select * from
win32_operatingsystem")
objpc.win32shutdown LOGOFF + FORCE
Next

Line containing LOGOFF + FORCE can be changed with
SHUTDOWN + FORCE or REBOOT or REBOOT + FORCE as per your
requirement. Save this notepad file as logoff.vbs
From command prompt run this file to logoff at desired
times.
Let me know if this helps.
-Nimit

-----Original Message-----
Is there a command line tool that could be used in a
batch script to log the user off the desktop back to Ctrl-
Alt-Del login screen?
 
Const LOGOFF = 0
Const SHUTDOWN = 1
Const REBOOT = 2
Const FORCE = 4
Const POWEROFF = 8
For Each objPC In GetObject("winmgmts:
{(shutdown)}").ExecQuery("Select * from
Win32_OperatingSystem")
objPC.Win32Shutdown LOGOFF
Next

-Nimit

-----Original Message-----
Is there a command line tool that could be used in a
batch script to log the user off the desktop back to Ctrl-
Alt-Del login screen?
 
And the amusing thing, of course, is that XP/Windows Server 2003 comes with
VASTLY more commandline tools than Windows 2000 ever did... so we're really
not trying to phase out the command prompt -- we're enhancing its usage.

For example, for shutdown:
1. XP/Windows Server 2003 comes with SHUTDOWN.EXE, which would do what you
want.
2. Small script using WMI also does the same for XP/W2K3, and works on W2K
as well
3. NT4 accepts the predecessor to SHUTDOWN.EXE calling ExitWindowEx.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
Matthias said:
Hallo Olaf,
what makes you that shure, he is using windows xp or newer ?
w2k and I think also nt have no logoff.exe

Ja, das is correct... this is a win2000 group after all! ;-) I know, M$
trying to make everyone believe there is no need for a command promp did not
make such a group as thus under the WinXP groups.

I'll check the Win2K RK CD I have, or the online thing.

I had tried the PSShutdown which I use for reboots, it had a -o which said
something about logging off the desktop, but alas it rebooted the box.
 
Back
Top