How do I logout from vbscript?

tzenes picture tzenes · Oct 15, 2010 · Viewed 18.2k times · Source

I'm using a VBScript to run an application on my Win Server 2003, and I want it to log the user off after a set amount of time. Something along the lines of:

Set WshShell = WScript.CreateObject("WScript.Shell")
Set OExe = WshShell.exec("somecommand.exe")
WScript.Sleep 1000000
OExe.Terminate
<Insert LogOff code>

Answer

Andrew Cooper picture Andrew Cooper · Oct 15, 2010

Something like

WshShell.Run "C:\windows\system32\shutdown.exe /l", 0, false

should do the trick