December 2003
Intermediate to advanced
416 pages
13h 50m
English
Some changes you make to a
DNS
Server require the service to be restarted for the changes to take
effect. We can utilize the
StopService
and
StartService
methods as shown in the following
example to do this:
strServer = "terminator.movie.edu"
on error resume next
set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
objDNSServer.StopService
if Err Then
WScript.Echo "StopService failed: " & Err.Description
Wscript.Quit
end if
objDNSServer.StartService
if Err Then
WScript.Echo "StartService failed: " & Err.Description
Wscript.Quit
end if
WScript.Echo "Restart successful"Read now
Unlock full access