The book you need to succeed! Vbscript, jscript



Yüklə 12,95 Mb.
Pdf görüntüsü
səhifə87/91
tarix07.11.2018
ölçüsü12,95 Mb.
#78682
1   ...   83   84   85   86   87   88   89   90   91

237
 
Working with the Windows Registry and Event Logs 
12
Managing WINS through Windows scripts
WINS is the Windows Internet Name Service and it is used to resolve computer names to IP 
addresses. If you log on to a domain, your computer may use WINS to access resources on the 
network. 
The 
Parameters
 key is the primary key that controls WINS configuration. This key is located in 
the folder:
HKEY_LOCAL_MACHINE
    \SYSTEM
        \CurrentControlSet
            \Services
                \WINS
                    \Parameters
Table 12-2 summarizes the main values that you’ll use to configure WINS.
TABLE 12-2
Key Values for Configuring WINS
Key Value
Value Type
Value Description
BackUpDirPath
REG_EXPAND_SZ
Sets the location for WINS backup files. You can change 
this location to any valid folder path on the local system.
BurstHandling
REG_DWORD
Determines whether WINS uses burst handling mode. Set 
to 1 to turn the mode on. Set to 0 to turn the mode off.
BurstQueSize
REG_DWORD
Sets the size of the burst queue threshold. The default 
value is 500, but you can use any value from 50 to 
5,000. When the threshold you’ve set is reached, WINS 
switches to burst handling mode.
DbFileNm
REG_EXPAND_SZ
Sets the full file path to the WINS database; for example, 
%windir%\system32\wins.mdb
.
DoBackupOnTerm
REG_DWORD
Determines whether the WINS database is backed 
up when the WINS server is stopped. Set to 1 to turn 
backups on. Set to 0 to turn backups off.
LogDetailedEvents
REG_DWORD
Determines whether detailed logging of WINS activity 
is used. All WINS events are logged in the System event 
log automatically and usually you will want to turn on 
detailed logging only for troubleshooting. Set to 1 to turn 
on detailed logging. Set to 0 to turn off detailed logging.
LogFilePath
REG_EXPAND_SZ
Sets an alternative log file path.
continued
86804c12.indd   237
86804c12.indd   237
1/21/09   1:26:54 PM
1/21/09   1:26:54 PM


238
 Part 
II
 
Windows VBScript and JScript
Key Value
Value Type
Value Description
LoggingOn
REG_DWORD
Determines whether logging is enabled. Set to 1 to turn on 
logging. Set to 0 to turn off logging. If you turn off logging
WINS events are not logged in the System event log.
RefreshInterval
REG_DWORD
Sets the interval during which a WINS client must renew 
its computer name. The minimum value is 2,400 seconds 
and the default value is 518,400 seconds (six days).
TombstoneInterval
REG_DWORD
Sets the interval during which a computer name can 
be marked for removal. The value must be equal to or 
greater than the renewal interval or 345,600 seconds 
(four days), whichever is smaller.
TombstoneTimeout
REG_DWORD
Sets the interval during which a computer name can be 
removed from the WINS database. The value must be 
greater than or equal to the refresh interval.
VerifyInterval
REG_DWORD
Sets the interval after which a WINS server must 
verify computer names originating from other WINS 
servers. This allows inactive names to be removed. The 
minimum value is 2,073,600 seconds (24 days).
Now that you know the key values and how they are used, you can create a script that manages the 
WINS configuration. You can then use this script on other WINS servers to ensure that the configu-
rations are exactly the same, which is usually what you want. An example script is shown as 
Listing 12-5.
LISTING 12-5
Configuring WINS
VBScript
updatewins.vbs
Dim Path
Path = “HKLM\SYSTEM\CurrentControlSet\Services\WINS\Parameters\”
Set ws = WScript.CreateObject(“WScript.Shell”)
ws.RegWrite Path & “BackUpDirPath”,”%windir%\system32”, “REG_EXPAND_SZ”
ws.RegWrite Path & “BurstHandling”,1, “REG_DWORD”
ws.RegWrite Path & “BurstQueSize”,500, “REG_DWORD”
ws.RegWrite Path & “DbFileNm”,”%windir%\system32\wins.mdb”, “REG_EXPAND_SZ”
ws.RegWrite Path & “DoBackupOnTerm”,1, “REG_DWORD”
TABLE 12-2 
(continued)
86804c12.indd   238
86804c12.indd   238
1/21/09   1:26:54 PM
1/21/09   1:26:54 PM


239
 
Working with the Windows Registry and Event Logs 
12
ws.RegWrite Path & “LogDetailedEvents”,0, “REG_DWORD”
ws.RegWrite Path & “LogFilePath”,”%windir%\system32”, “REG_EXPAND_SZ”
ws.RegWrite Path & “LoggingOn”,1, “REG_DWORD”
ws.RegWrite Path & “RefreshInterval”,518400, “REG_DWORD”
ws.RegWrite Path & “TombstoneInterval”,518400, “REG_DWORD”
ws.RegWrite Path & “TombstoneTimeout”,518400, “REG_DWORD”
ws.RegWrite Path & “VerifyInterval”,2073600, “REG_DWORD”
JScript
updatewins.js
var Path
Path = “HKLM\\SYSTEM\\CurrentControlSet\\Services\\WINS\\Parameters\\”
var ws = WScript.CreateObject(“WScript.Shell”)  
ws.RegWrite(Path + “BackUpDirPath”,”%windir%\\system32”, “REG_EXPAND_SZ”)
ws.RegWrite(Path + “BurstHandling”,1, “REG_DWORD”)
ws.RegWrite(Path + “BurstQueSize”,500, “REG_DWORD”)
ws.RegWrite(Path + “DbFileNm”,”%windir%\\system32\\wins.mdb”, “REG_EXPAND_SZ”)
ws.RegWrite(Path + “DoBackupOnTerm”,1, “REG_DWORD”)
ws.RegWrite(Path + “LogDetailedEvents”,0, “REG_DWORD”)
ws.RegWrite(Path + “LogFilePath”,”%windir%\\system32”, “REG_EXPAND_SZ”)
ws.RegWrite(Path + “LoggingOn”,1, “REG_DWORD”)
ws.RegWrite(Path + “RefreshInterval”,518400, “REG_DWORD”)
ws.RegWrite(Path + “TombstoneInterval”,518400, “REG_DWORD”)
ws.RegWrite(Path + “TombstoneTimeout”,518400, “REG_DWORD”)
ws.RegWrite(Path + “VerifyInterval”,2073600, “REG_DWORD”)
Managing DHCP through Windows scripts
DHCP is the Dynamic Host Configuration Protocol and it is used to dynamically assign network 
configuration settings to computers. If you log on to a workstation in an Active Directory domain, 
your computer probably uses DHCP to obtain the settings it needs to access the network.
DHCP configuration is located in the folder:
HKEY_LOCAL_MACHINE
    \SYSTEM
        \CurrentControlSet
            \Services
                \DHCPServer
                    \Parameters
The main values that you’ll want to work with to configure DHCP are summarized in Table 12-3.
86804c12.indd   239
86804c12.indd   239
1/21/09   1:26:54 PM
1/21/09   1:26:54 PM


Yüklə 12,95 Mb.

Dostları ilə paylaş:
1   ...   83   84   85   86   87   88   89   90   91




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə