windowsvbscriptlogoff

How do I logout from vbscript?


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>

Solution

  • Something like

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

    should do the trick