Microsoft Windows Server DNS Server Property Discovery

Microsoft.Windows.Server.DNS.Server.Property.Discovery (Discovery)

Discovers additional properties of the DNS server

Knowledge Base article:

Summary

Uses WMI to discover additional properties of the DNS server not exposed to the earlier, registry-based discovery.

Element properties:

TargetMicrosoft.Windows.Server.DNS.Server
EnabledTrue
Frequency14580
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Microsoft.Windows.Server.DNS.ActionAccount

Source Code:

<Discovery ID="Microsoft.Windows.Server.DNS.Server.Property.Discovery" Enabled="true" Target="Microsoft.Windows.Server.DNS.Server" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Windows.Server.DNS.Server">
<Property TypeID="Microsoft.Windows.Server.DNS.Server" PropertyID="EventLoggingLevel"/>
<Property TypeID="Microsoft.Windows.Server.DNS.Server" PropertyID="ScavengingInterval"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Microsoft.Windows.Server.DNS.Server.IPAddress">
<Property TypeID="Microsoft.Windows.Server.DNS.Server.IPAddress" PropertyID="IPAddress"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="Microsoft.Windows.Server.DNS.ActionAccount" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>14580</IntervalSeconds>
<SyncTime/>
<ScriptName>Microsoft.Windows.Server.DNS.Server.Property.Discovery.vbs</ScriptName>
<Arguments/>
<ScriptBody><Script>'Copyright (c) Microsoft Corporation. All rights reserved.

'*************************************************************************
' ScriptName: Microsoft.Windows.Server.DNS.Server.Property.Discovery
'
' Purpose: DNS Server Property Discovery
'
' File: Microsoft.Windows.Server.DNS.Server.Property.Discovery.vbs
'*************************************************************************

Option Explicit

SetLocale("en-us")

Dim strSourceId, strManagedEntityId, strTargetComputer, strListenAddresses, wmiNamespaceString, wmiQueryString, junkVar, address
Dim oAPI, oDiscoveryData, objWMIService, colitems, objItem, lInst

strSourceId = "$MPElement$"
strManagedEntityId = "$Target/Id$"
strTargetComputer = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$"
strListenAddresses = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/IPAddress$"
wmiNamespaceString = "winmgmts://./root/MicrosoftDNS"
wmiQueryString = "SELECT EventLogLevel, ScavengingInterval, ListenAddresses, ServerAddresses FROM MicrosoftDNS_Server"

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oDiscoveryData = oAPI.CreateDiscoveryData(0, strSourceId, strManagedEntityId)

ON ERROR RESUME NEXT

set objWMIService = GetObject(wmiNamespaceString)

If Err.Number &lt;&gt; 0 Then
Call ReturnDiscovery
End If

set colitems = objWMIService.ExecQuery(wmiQueryString)
junkVar = colitems.count

If Err.Number &lt;&gt; 0 Then
Call ReturnDiscovery
End If

If ( colitems.count = 0 ) Then
Call ReturnDiscovery
End If

For Each objItem In colitems

If IsNull(objItem.EventLogLevel) Then
Call ReturnDiscovery
End If

If Not IsNumeric(objItem.EventLogLevel) Then
Call ReturnDiscovery
End If

Set lInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Server']$")
call lInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", strTargetComputer)
call lInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Server']/Name$", strTargetComputer)
call lInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Server']/EventLoggingLevel$", objItem.EventLogLevel)
call lInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Server']/ScavengingInterval$", objItem.ScavengingInterval)
Call oDiscoveryData.AddInstance(lInst)

If Not IsNull(objItem.ListenAddresses) Then
strListenAddresses = Join(objItem.ListenAddresses, ",")
End If

For Each address In Split(strListenAddresses, ",")
Set iInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Server.IPAddress']$")
call iInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", strTargetComputer)
call iInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Server']/Name$", strTargetComputer)
call iInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Server.IPAddress']/IPAddress$", address)
Call oDiscoveryData.AddInstance(iInst)
Next

Next

Call ReturnDiscovery



Sub ReturnDiscovery

Call oAPI.Return(oDiscoveryData)
WScript.Quit

End Sub</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>