Re: Terminate a process.
From: Rob Shaw-Fuller (robshawfuller_at_hotmail.com)
Date: 12/09/04
- Next message: Script3r: "Reading the SchedlgU.txt file - Not how to do it, but how to do it better."
- Previous message: Sandra: "Scheduled VBScript can't launch network program via wShell.Run"
- In reply to: Steve Fu: "Terminate a process."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 9 Dec 2004 13:48:25 -0500
"Steve Fu" <Steve Fu@discussions.microsoft.com> wrote...
> Hi I work for a school and want to be able to stop certain kids (when they
> misbehave) from having internet access. I have looked at the example in
> version2.0 of the portable script center, under processes - Preventing a
> process from running.
>
> strComputer = InputBox("Enter Computer to Diable Internet Access to.")
> 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
>
> This kills Internet explorer fine and prevents it from running, but if a
> kid
> then behaves, how can I undo the script without rebooting the machine ?
It looks like this script is designed to run from a remote computer. Do you
run it from your workstation? If so, you should be able to just kill the
wscript process with Task Manager to cancel the script. Or follow Torgeir's
advice about stopping the WMI service on the target.
Also, I'm sure that you already know this, but your script is only going to
stop Internet Explorer. If you really want to stop all internet access,
you'll need to target a number of different browsers, like Mozilla &
Firefox. Also, a clever chap could probably circumvent your script by
renaming his browser's executable.
The best way to selectively block internet access is through the use of a
firewall and/or a proxy server, of which there are many different varieties.
But that's off-topic for a scripting NG....
Rob Shaw-Fuller
robshawfuller@hotmail.com
- Next message: Script3r: "Reading the SchedlgU.txt file - Not how to do it, but how to do it better."
- Previous message: Sandra: "Scheduled VBScript can't launch network program via wShell.Run"
- In reply to: Steve Fu: "Terminate a process."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|