December 2003
Intermediate to advanced
416 pages
13h 50m
English
If you’ve ever wanted
a
programmatic way to access the output of the dnscmd
/statistics command, now you have one. The
MicrosoftDNS_Statistic
class provides complete access to all the performance metrics you can
get using dnscmd or Performance Monitor. And
it’s easy too! Check out this script, which prints
out all of the statistics:
strServer = "terminator.movie.edu "
set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
set objStats = objDNS.ExecQuery("Select * from MicrosoftDNS_Statistic ")
for each objStat in objStats
WScript.Echo " " & objStat.Name & " : " & objStat.Value
nextAnd if you want to access only a subset of the metrics (for example, all of the entries that start with “Records”) you only need to modify the WQL query slightly:
set objStats = objDNS.ExecQuery("Select * from MicrosoftDNS_Statistic " & _
where Name like 'Records%' ")Read now
Unlock full access