Page 1 of 1 1
Topic Options
#204042 - 2012-01-10 10:58 AM Create Reg Entry Based On IP Address
sgraham978 Offline
Fresh Scripter

Registered: 2007-02-01
Posts: 11
I'm currently trying to write into our Kix scripts a section which checks the IP address and if it has a 10.20.x.x address then it creates a particular reg entry, otherwise it skips and goes to the next option within the script.

I've currently got the following....

 Code:
if Instr(@IPADDRESS," 10. 20")
	MD c:\Proxy_%username%
	COPY "\\mydomain\netlogon\file.pac" "c:\Proxy_@userid\file.pac"
	$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
	WRITEVALUE($key,"AutoConfigURL","file://c:/proxy_@userid/file.pac","REG_SZ")
	WRITEVALUE($key,"ProxyEnable","0","REG_DWORD")
	WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "2", "REG_DWORD")
ENDIF


This isn't working. Am I using the right commands/syntax or should I be using something else?

Any help is greatly appreciated.


Edited by Mart (2012-01-10 11:38 AM)
Edit Reason: Please use code tags when posting code.

Top
#204043 - 2012-01-10 11:37 AM Re: Create Reg Entry Based On IP Address [Re: sgraham978]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I made some minor changes to your script.
Please give it a once over and see if it is clear what it does and if it works better for you.

 Code:
If Left(@IPADDRESS0, 8) = " 10. 20."
	MD "c:\Proxy_" + @USERID
	Copy "\\mydomain\netlogon\file.pac" "c:\Proxy_" + @USERID + "\file.pac"
	$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
	$rc = WriteValue($key, "AutoConfigURL", "file://c:/proxy_" + @USERID + "/file.pac", "REG_SZ")
	$rc = WriteValue($key, "ProxyEnable", "0", "REG_DWORD")
	$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "2", "REG_DWORD")
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.048 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org