Microsoft Windows Server DNS Forwarder Conditional Discovery

Microsoft.Windows.Server.DNS.Forwarder.Conditional.Discovery (Discovery)

Discovers Conditional Forwarders

Knowledge Base article:

Summary

Uses WMI to discover conditional forwarders.

Element properties:

TargetMicrosoft.Windows.Server.DNS.Server
EnabledTrue
Frequency14460
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.Forwarder.Conditional.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.Forwarder.IPAddress.Conditional.Forward">
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder.IPAddress" PropertyID="IPAddress"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Microsoft.Windows.Server.DNS.Forwarder.IPAddress.Conditional.Reverse">
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder.IPAddress" PropertyID="IPAddress"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Microsoft.Windows.Server.DNS.Forwarder.Conditional.Forward">
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="DomainName"/>
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="IsConditional"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="ForwarderTimeout"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Microsoft.Windows.Server.DNS.Forwarder.Conditional.Reverse">
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="DomainName"/>
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="IsConditional"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="Microsoft.Windows.Server.DNS.Forwarder" PropertyID="ForwarderTimeout"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" RunAs="Microsoft.Windows.Server.DNS.ActionAccount" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>14460</IntervalSeconds>
<SyncTime/>
<ScriptName>Microsoft.Windows.Server.DNS.Forwarder.Conditional.Discovery.vbs</ScriptName>
<Arguments/>
<ScriptBody><Script> 'Copyright (c) Microsoft Corporation. All rights reserved.

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

Option Explicit

SetLocale("en-us")

Dim strSourceId, strManagedEntityId, strTargetComputer, wmiNamespaceString, wmiQueryString
Dim junkVar
Dim oAPI, oDiscoveryData, objWMIService, colitems, objItem, lInst
Dim i, iInst

strSourceId = "$MPElement$"
strManagedEntityId = "$Target/Id$"
strTargetComputer = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$"
wmiNamespaceString = "winmgmts://./root/MicrosoftDNS"
wmiQueryString = "SELECT * FROM MicrosoftDNS_Zone WHERE ZoneType = 4"

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 Not IsNull(objItem.Name) Then

If LCase(Right(objItem.Name, 13)) = ".in-addr.arpa" Then
Set lInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder.Conditional.Reverse']$")
Else
Set lInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder.Conditional.Forward']$")
End If

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.Forwarder']/DomainName$", objItem.Name)
call lInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder']/IsConditional$", CBool("True"))
call lInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder']/ForwarderTimeout$", objItem.ForwarderTimeout)
call lInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", objItem.Name &amp; " on " &amp; strTargetComputer)
Call oDiscoveryData.AddInstance(lInst)

For i = 0 to UBound(objItem.MasterServers)
If LCase(Right(objItem.Name, 13)) = ".in-addr.arpa" Then
Set iInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder.IPAddress.Conditional.Reverse']$")
Else
Set iInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder.IPAddress.Conditional.Forward']$")
End If

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.Forwarder']/DomainName$", objItem.Name)
call iInst.AddProperty("$MPElement[Name='Microsoft.Windows.Server.DNS.Forwarder.IPAddress']/IPAddress$", objItem.MasterServers(i))
Call oDiscoveryData.AddInstance(iInst)
Next

End If

Next

Call ReturnDiscovery



Sub ReturnDiscovery

Call oAPI.Return(oDiscoveryData)
WScript.Quit

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