The book you need to succeed! Vbscript, jscript



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

240
 Part 
II
 
Windows VBScript and JScript
TABLE 12-3
Key Values for Configuring DHCP
Key Value
Value Type
Value Description
BackupDatabasePath
REG_EXPAND_SZ
Sets the location for DHCP backup files. You 
can change this location to any valid folder 
path on the local system.
BackupInterval
REG_DWORD
Sets the interval for automatic backups. The 
default value is 60 minutes.
DatabaseCleanupInterval
REG_DWORD
Sets the interval for cleaning up old records in 
the DHCP database. The default value is 1,440 
minutes (24 hours).
DatabaseLoggingFlag
REG_DWORD
Determines whether audit logging is enabled. 
Audit logs track DHCP processes and requests. 
Set to 1 to turn on. Set to 0 to turn off.
DatabaseName
REG_SZ
Sets the file name for the DHCP database, for 
example, dhcp.mdb.
DatabasePath
REG_EXPAND_SZ
Sets the directory path for the DHCP database, 
for example, %SystemRoot%\System32\
dhcp
.
DebugFlag
REG_DWORD
Determines whether debugging is enabled. If 
debugging is enabled, detailed events are 
created in the event logs. Set to 1 to turn on. 
Set to 0 to turn off.
DetectConflictRetries
REG_DWORD
Sets the number of times DHCP checks to 
see if an IP address is in use before assigning. 
Generally, you’ll want to check IP addresses at 
least once before assigning them, which helps 
to prevent IP address conflicts.
DhcpLogDiskSpaceCheckInterval
REG_DWORD
Determines how often DHCP checks the 
amount of disk space used by DHCP. The 
default interval is 50 minutes.
DhcpLogFilePath
REG_SZ
Sets the file path for audit log, for example, 
%windir%\system32\dhcp
.
DhcpLogFilesMaxSize
REG_DWORD
Sets the maximum file size for all audit logs. 
The default is 7MB.
DhcpLogMinSpaceOnDisk
REG_DWORD
Sets the free-space threshold for writing to the 
audit logs. If the disk drive has less free space 
than the value specified, logging is temporarily 
disabled. The default value is 20MB.
continued
86804c12.indd   240
86804c12.indd   240
1/21/09   1:26:54 PM
1/21/09   1:26:54 PM


241
 
Working with the Windows Registry and Event Logs 
12
Key Value
Value Type
Value Description
RestoreFlag
REG_DWORD
Determines whether the DHCP is restored 
from backup when the DHCP server is started. 
Set this option to 1 only if you want to restore a 
previously saved DHCP database.
Using the key values shown in Table 12-3, you can create scripts that help you manage DHCP. 
Listing 12-6 shows an example script that reconfigures DHCP settings.
LISTING 12-6
Configuring DHCP
VBScript
updatedhcp.vbs
Dim Path
Path = “HKLM\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters\”
Set ws = WScript.CreateObject(“WScript.Shell”)
ws.RegWrite Path & “BackupDatabasePath”,”%windir%\dhcp\backup”, “REG_EXPAND_SZ”
ws.RegWrite Path & “BackupInterval”,60, “REG_DWORD”
ws.RegWrite Path & “DatabaseCleanupInterval”,1440, “REG_DWORD”
ws.RegWrite Path & “DatabaseLoggingFlag”,1, “REG_DWORD”
ws.RegWrite Path & “DatabaseName”,”dhcp.mdb”, “REG_SZ”
ws.RegWrite Path & “DatabasePath”,”%windir%\system32\dhcp”, “REG_EXPAND_SZ”
ws.RegWrite Path & “DebugFlag”,0, “REG_DWORD”
ws.RegWrite Path & “DetectConflictRetries”,2, “REG_DWORD”
ws.RegWrite Path & “DhcpLogDiskSpaceCheckInterval”,50, “REG_DWORD”
ws.RegWrite Path & “DhcpLogFilePath”,”d:\logs\dhcp”, “REG_SZ”
ws.RegWrite Path & “DhcpLogFilesMaxSize”,7, “REG_DWORD”
ws.RegWrite Path & “DhcpLogMinSpaceOnDisk”,20, “REG_DWORD”
ws.RegWrite Path & “RestoreFlag”,0, “REG_DWORD”
JScript
updatedhcp.js
var Path
Path = “HKLM\\SYSTEM\\CurrentControlSet\\Services\\DHCPServer\\Parameters\\”
var ws = WScript.CreateObject(“WScript.Shell”)
ws.RegWrite(Path+”BackupDatabasePath”,”%windir%\\dhcp\\backup”,”REG_EXPAND_SZ”)
ws.RegWrite(Path + “BackupInterval”,60, “REG_DWORD”)
ws.RegWrite(Path + “DatabaseCleanupInterval”,1440, “REG_DWORD”)
ws.RegWrite(Path + “DatabaseLoggingFlag”,1, “REG_DWORD”)
ws.RegWrite(Path + “DatabaseName”,”dhcp.mdb”, “REG_SZ”)
ws.RegWrite(Path + “DatabasePath”,”%windir%\\system32\\dhcp”,”REG_EXPAND_SZ”)
ws.RegWrite(Path + “DebugFlag”,0, “REG_DWORD”)
continued
86804c12.indd   241
86804c12.indd   241
1/21/09   1:26:54 PM
1/21/09   1:26:54 PM


242
 Part 
II
 
Windows VBScript and JScript
ws.RegWrite(Path + “DetectConflictRetries”,2, “REG_DWORD”)
ws.RegWrite(Path + “DhcpLogDiskSpaceCheckInterval”,50, “REG_DWORD”)
ws.RegWrite(Path + “DhcpLogFilePath”,”d:\\logs\\dhcp”, “REG_SZ”)
ws.RegWrite(Path + “DhcpLogFilesMaxSize”,7, “REG_DWORD”)
ws.RegWrite(Path + “DhcpLogMinSpaceOnDisk”,20, “REG_DWORD”)
ws.RegWrite(Path + “RestoreFlag”,0, “REG_DWORD”)
Using Event Logs
Windows event logs track activity on a particular system. You can use the logs to track system pro-
cesses, to troubleshoot system problems, and to monitor system security. On Windows servers and 
workstations, you’ll find the following logs:
Application Log:

 Tracks events logged by applications, such as by SQL Server.
Security

 Log: Tracks events you’ve set for auditing with local or global group policies. 
Only authorized users can access security logs.
System

 Log: Tracks events logged by the operating system or its components, such as 
WINS or DHCP.
Directory

 Service: Tracks events logged by Active Directory.
DNS

 Server: Tracks DNS queries, responses, and other DNS activities.
File

 Replication Service: Tracks file replication activities on the system.
Viewing event logs
You can view event logs through Event Viewer. This utility is in the Administrative Tools folder 
and can also be accessed through the System Tools node in the Computer Management console. 
Windows Vista has a slightly updated look and feel from Windows XP. As shown in Figure 12-1, 
Event Viewer’s main window is divided into three panels. The left panel is called the console tree. 
The middle panel is the view pane, and the right panel is the actions menu. To view a log, click its 
entry in the console tree and then the selected log is displayed in the middle panel.
When you start Event Viewer, the utility automatically accesses event logs on the local system. You 
can access event logs on remote computers as well. Right-click Event Viewer in the console tree and 
then select Connect to Another Computer. You can then use the Select Computer dialog box shown 
in Figure 12-2 to connect to a remote computer. Choose the Another Computer radio button and 
then enter the name or IP address of the computer to which you want to connect in the input field 
provided. Afterward, click OK.
LISTING 12-6 
(continued)
86804c12.indd   242
86804c12.indd   242
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ə