Page 2 of 2 <12
Topic Options
#41961 - 2003-06-24 10:49 AM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
Anth,

You will have to test this, as I don't have W2k but this should work

code:
; Kix script to 'fix' registry keys with regards to NIC's
; Authored from Kix Bulletin Board, courtesy of grasshopper, sealeopard and all those who helped



$NicKey = EnumKey("HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkCards\",0)
$NicCrd = ReadValue("HKLM\Software\Microsoft\WindowsNT\CurrentVersion\NetworkCards\"+$NicKey,"ServiceName")
$TCPIPUpdate=ReadValue("HKLM\SOFTWARE\MyCompany\DesktopSettings","TCPIPUpdate")
If $TCPIPUpdate<>"Updated"
If @PRODUCTTYPE="Windows 2000 Professional"
WriteValue("HKLM\System\CurrentControlSet\Services\NetBT\Parameters\Interfaces\"+$NicCrd,"NameServerList","192.168.10.100|192.168.10.101","REG_MULTI_SZ")
WriteValue("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters", "Domain","", "REG_SZ")
WriteValue("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters", "NameServer","", "REG_SZ")
WriteValue("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters", "SearchList","","REG_SZ")
EndIf
WriteValue("HKLM\SOFTWARE\MyCompany\DesktopSettings","TCPIPUpdate","","REG_SZ")
EndIf

The arrayenumkey is what writes the entries to all cards so removing it should now only write to the nic in use.

Give it a try anyway.

Grasshopper75

[ 24. June 2003, 17:48: Message edited by: Grasshopper75 ]

Top
#41962 - 2003-06-24 11:23 AM Re: Changing WINS with a script
anthonyalderson Offline
Getting the hang of it

Registered: 2003-03-20
Posts: 52
Loc: England
sorry grasshopper for some reason its still changing all the nic's, and i'm still having the same problem with regards to the wins addresses themselves, trying to put two wins addresses in results in the second wins address being corrupted somehow, it simply doesnt understand what we're trying to do and comes up with the first ip address then a load of starnge characters, like those found in a html email sent as text. not sure where i go from here, i think i'll have to check the knowledgebase and see if theres anything in there with regards to this problem, oh and sorry for the lack of proper punctuation.....

Anth

Top
#41963 - 2003-06-24 11:26 AM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
Enter the WINS entries manually then look at the reg key to make sure the script is writing to the correct key and in the correct format.
Top
#41964 - 2003-06-24 11:42 AM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
This is driving me insane, if anyone has access to an XP machine can they please see if this works for them. I am running this with local admin.

You can enter whatever entries you wish.

What I dont understand is that I can manually enter the entries without a problem but I can't add them through a script.

code:
$NicKey = EnumKey ("HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkCards",0)
$NicCrd = ReadValue ("HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkCards\"+$NicKey,"ServiceName")
WriteValue ("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"+$NicCrd,"Domain","yourdomain.com","REG_SZ")
WriteValue ("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"+$NicCrd,"NameServer","192.168.10.1","REG_SZ")
WriteValue ("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"+$NicCrd,"RegistrationEnabled","1","REG_DWORD")
WriteValue ("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"+$NicCrd,"RegisterAdapterName","1","REG_DWORD")
WriteValue ("HKLM\System\CurrentControlSet\Services\Tcpip\Parameters","SearchList","yourdomain.com","REG_SZ")

The result should be that yourdomain.com will appear as a DNS suffix and the ip address 192.168.10.1 will appear in the DNS server addresses. The two checkboxes down the bottom of the advanced TCP/IP settings should also be checked.

Grasshopper75

Top
#41965 - 2003-06-24 01:20 PM Re: Changing WINS with a script
anthonyalderson Offline
Getting the hang of it

Registered: 2003-03-20
Posts: 52
Loc: England
could you tell me what results you're getting grasshopper,

I'm using a win2k machine myself but the keys are all still the same and the advanced ctp/ip settings screen is the same so it should be almost identical.

Anth

Top
#41966 - 2003-06-24 01:28 PM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
OK, I have just tried the actually script I posted as it was a copy and paste out of my original script and that works. So, there must be something else going on in my original script ! I'll keep you posted.

[ 24. June 2003, 13:46: Message edited by: Grasshopper75 ]

Top
#41967 - 2003-06-24 02:09 PM Re: Changing WINS with a script
anthonyalderson Offline
Getting the hang of it

Registered: 2003-03-20
Posts: 52
Loc: England
okay well in the meantime can anyone help me with this wins change script grasshopper bore and i developed with the help of all on here.

its now been narrowed down to one key namely:
WriteValue("HKLM\System\CurrentControlSet\Services\NetBT\Parameters\Interfaces\"+$NicCrd,"NameServerList","192.168.10.100 192.168.10.101","REG_MULTI_SZ")

but for some reason the damn key wont accept two wins addresses, not through a script anyway, maybe its me but seperating them like above results in ascii characters being displayed after the second address. can anyone please help me, i'm begging on my knees now lol....

oh and grasshopper thanks for your last script it works perfect apart from the above problem.

Anth

Top
#41968 - 2003-06-24 02:09 PM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
Right, I have narrowed it down to something to do with the array in my original. I think the FOR EACH may be incorrect.

Anth, are you still using the array in your script ?

Top
#41969 - 2003-06-24 02:25 PM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
Right, after days of staring at my code, it finally occurred to me where I had gone wrong. I had set a variable in the array which I was then using the same variable to write to the registry, which was not right. After changing the variable name, it all works.

Thank God thats over !

Top
#41970 - 2003-06-24 02:45 PM Re: Changing WINS with a script
anthonyalderson Offline
Getting the hang of it

Registered: 2003-03-20
Posts: 52
Loc: England
i'm still using the array but i'm not using the FOR EACH part of the script, it kept resulting in writing to all nic regsitry keys so after you showed me the modified script for win2k i took that part out and now it works fine, all it does is detects the producttype and writes the keys necessary for the one primary nic,

my only problem now goddamnit is the fact i cant seem to get it working with two wins addresses without resulting in the key showing ascii characters.

sorry i couldnt help you with your own though grasshopper,

Anth

Top
#41971 - 2003-06-24 02:57 PM Re: Changing WINS with a script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you provide multiple IP addresses into a REG_MULTI_SZ, then you need to separate them with the pipe symbol |. This is explained in the KiXtart Manual under WRITEVALUE().

[ 24. June 2003, 15:12: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#41972 - 2003-06-24 03:07 PM Re: Changing WINS with a script
anthonyalderson Offline
Getting the hang of it

Registered: 2003-03-20
Posts: 52
Loc: England
jens i'm gonna go and try it now but if it works you can call me all the names under the sun,

and i thank you from the bottom of my heart for your pearls of wisdom

Anth "in debt to all"

Top
#41973 - 2003-06-24 03:32 PM Re: Changing WINS with a script
Grasshopper75 Offline
Getting the hang of it

Registered: 2002-01-15
Posts: 99
Loc: Melbourne, Australia
I don't suppose anyone knows where the TCP/IP reg keys are for dialup connections ? I need to edit these values as well.

Grasshopper75

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 928 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.067 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

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