Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Start  a  Process  and  Then  Log  the  User  Off  When  That  Process  Ends  

 Content of Start a Process and Then Log the User Off When That Process Ends.vbs
MD5 Hash: 590D9C111E6C017728CEE6BB22B71934
strComputer = "."

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

objWMIService.Create "Notepad.exe", null, null, intProcessID

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService. _
ExecNotificationQuery("Select * From __InstanceDeletionEvent " _
& "Within 1 Where TargetInstance ISA 'Win32_Process'")
Do
Set objProcess = colItems.NextEvent
If objProcess.TargetInstance.ProcessID = intProcessID Then
Exit Do
End If
Loop

Set objWMIService = GetObject("winmgmts:{(Shutdown)}\\" & _
strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objItem in colItems
objItem.Win32Shutdown(0)
Next



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a