Hi Chaps...

I've been trying to put together a script that will turn off the internet on computers in a class room. I've got the registry keys for the current user etc... but it doesn't want to work.

Would one of you kind chaps have a look at my code, as I am now scratching my head.

Here we go...

:)

[code]
Function disableinternet($dest)
shell '%comspec% /c ping -n 1 $dest | find "Reply" >nul'
if @error = 0
? "Host $dest is alive"

$ikey="\\$dest\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
IF (ExistKey($ikey) = 0)

$proxy = ReadValue($ikey, "ProxyServer")
? $proxy

IF (len(ReadValue($ikey,"ProxyServer")) <> 0)
IF (WriteValue($ikey, "ProxyServer", "10.0.0.1:5555", "REG_SZ") <> 0)
? "Warning "+@error+": "+@serror
ELSE
? "Update: Proxy Server set to 10.0.0.1:5555"
ENDIF
ELSE
? "Warning "+@error+": "+@serror
ENDIF
ENDIF
IF (ExistKey($ikey) = 0)
IF (len(ReadValue($ikey,"ProxyEnable")) <> 0)
IF (WriteValue($ikey, "ProxyEnable", "1", "REG_BINARY") <> 0)
? "Warning "+@error+": "+@serror
ELSE
? "Update: Proxy is Enabled"
ENDIF
ELSE
? "Warning "+@error+": "+@serror
ENDIF
ENDIF

else
? "Host $dest is dead or just wants to be alone right now!"
endif
EndFunction

[/code]
_________________________
Who are you? Who slips into my robot body and whispers to my ghost?