Re: Terminate a process.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rob Shaw-Fuller (robshawfuller_at_hotmail.com)
Date: 12/09/04


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



Relevant Pages

  • Script to connect to internet at bootup
    ... In the building where I live we have a bit of a "special" Internet access, i.e. we need to authenticate on an Internet page at a given URL. ... I have no idea how the network "knows" that I rebooted my computer, but apparently it knows as if I don't re-authenticate I have no Internet access. ... I'd like to have a script that authenticates me each time I boot. ... Writing the script is not a problem: just a curl command. ...
    (Ubuntu)
  • Re: Accessing function file on another domanin
    ... Mike Harvey wrote: ... calling functions like that directly from the querystring ... webserver (ie if it is on the Internet anyone with Internet access) can ... In your second example script A calls script B, ...
    (alt.php)
  • PHP script to disable/enable internet access
    ... (iff network status = inactive) ... Your Internet Access is DISABLED ... "/sbin/network start" or whatever the script is and refresh the page ...
    (comp.lang.php)
  • delegating a script execution on workstations
    ... internet access via IE 6.0 disabled. ... will remotely relogin (all workstations approx. ... particular rights would be needed for the user to remotely execute a script ...
    (microsoft.public.windows.server.scripting)
  • Re: TR - Russos F&W Trip - Day 1 of 6
    ... and $ on internet access so he can watch them on ... Not a grinch IMO! ... DH and I always paid for the "basics" as determined by us, and our kids ... could spend some portion of their gift money on extras. ...
    (rec.arts.disney.parks)