VirtualBox

Ticket #1410: Restart.vbs

File Restart.vbs, 707 bytes (added by LesDes, 14 years ago)

VB script to kill and then restart VBoxTray.exe

Line 
1' Based on: Process.vbs by Guy Thomas http://computerperformance.co.uk/
2' -------------------------------------------------------'
3Option Explicit
4Dim objWMIService, objProcess, colProcess, strComputer, strList, objShell
5strComputer = "."
6
7Set objWMIService = GetObject("winmgmts:" _
8& "{impersonationLevel=impersonate}!\\" _
9& strComputer & "\root\cimv2")
10
11Set colProcess = objWMIService.ExecQuery _
12("Select * from Win32_Process")
13
14For Each objProcess in colProcess
15 If objProcess.name = "VBoxTray.exe" Then objProcess.terminate
16Next
17
18' Restart
19 Set objShell = CreateObject("Shell.Application")
20 objShell.ShellExecute "VBoxTray.exe", "", "", "open", 1
21
22WScript.Quit
23

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy