| |
cbosque
Posts: 5
Score: 0
Joined: 10/6/2004
From:
Status: offline
|
These two scripts work great when you save them and run them as .vbs but if you embedd them in html code I can't get them to work. It keeps saying "error on page". Thanks in advance, Carlos 1.) Dim colProcessList, objProcess, strProcess strProcess = "iexplore.exe" Set colProcessList = GetObject("Winmgmts:").ExecQuery _ ("Select * from Win32_Process Where Name ='" & strProcess & "'") For Each objProcess in colProcessList objProcess.Terminate( ) Next 2.) strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colMonitoredProcesses = objWMIService. _ ExecNotificationQuery("select * from __instancecreationevent " _ & " within 1 where TargetInstance isa 'Win32_Process'") i = 0 Do While i = 0 Set objLatestProcess = colMonitoredProcesses.NextEvent If objLatestProcess.TargetInstance.Name = "iexplore.exe" Then objLatestProcess.TargetInstance.Terminate End If Loop ..................................................................... Here is what the entire html page looks like. <html> <head><title>Test</title></head> <script language = "vbscript"> Sub KillExplorer Dim colProcessList, objProcess, strProcess strProcess = "iexplore.exe" Set colProcessList = GetObject("Winmgmts:").ExecQuery _ ("Select * from Win32_Process Where Name ='" & strProcess & "'") For Each objProcess in colProcessList objProcess.Terminate( ) Next End Sub Sub DoIt KillExplorer() End Sub </script> <body> <center> <input type = "button" name = "test" value = "test" OnClick = DoIT> </center> </body> </html>
|
|