How to modify WINS settings on client workstations
by Marcin Policht
Changing primary and secondary WINS addresses on Windows NT systems is not
exactly an easy task. Even though the parameters can be changed by registry
modifications, they are NIC specific, meaning scripting the changes would
require making sure that you'll account for all types of NICs in your
environment. It might be better to use an alternate method, which involves
SendKeys method of wsh. Unfortunately there are some caveats. First of all,
you'll need the newer version of Windows Script (version 5.0 or 5.5). Secondly,
the method is not very reliable, since it relies on sending keystrokes to the
active window, so you need to make sure that you don't have a curious user
hitting the keys while the script runs. There are better solutions for it (WinBatch
will perform much better in this situation) but it might be tough to beat the
price of this one. Here is the code. (This changes the IP of Primary and
Secondary WINS to 10.11.12.13 and 10.11.12.14. You might want to modify the
timing of the sleep method (in miliseconds))On Error resume next
set WshShell = CreateObject("WScript.Shell")
CPNA = WshShell.Run ("control ncpa.cpl ,2",1,FALSE)
WScript.Sleep 5000
WshShell.AppActivate(CPNA)
WshShell.SendKeys "T"
WScript.Sleep 1000
WshShell.SendKeys "%P"
WScript.Sleep 1000
WshShell.SendKeys "+{Tab}"
WScript.Sleep 1000
WshShell.SendKeys "{RIGHT 2}"
WScript.Sleep 1000
WshShell.SendKeys "%M"
WScript.Sleep 1000
WshShell.SendKeys "10"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "11"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "12"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "13"
WScript.Sleep 100
WshShell.SendKeys "%S"
WScript.Sleep 100
WshShell.SendKeys "10"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "11"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "12"
WScript.Sleep 100
WshShell.SendKeys "{ }"
WScript.Sleep 100
WshShell.SendKeys "14"
WScript.Sleep 100
WshShell.SendKeys "{Enter}"
WScript.Sleep 3000
WshShell.SendKeys "{Enter}"
WScript.Sleep 100
WshShell.SendKeys "{Tab}"
WScript.Sleep 100
WshShell.SendKeys "{Enter}"
WScript.Sleep 1000
