SNA Gateway Discovery

Microsoft.HostIntegrationServer.2016.SNAGatewayDiscovery (Discovery)

Discovers instances of the SNA gateway

Knowledge Base article:

Summary

The SNA Gateway discovery checks the registry location "HKLM\SOFTWARE\Microsoft\Host Integration Server\ConfiguredFeatures\NetworkIntegration" to verify that the SNA Service is configured. If this service is configured, the Host Integration Server 2016 Management Pack reads the registry to get the name of the SNA Subdomain "HKLM\SYSTEM\CurrentControlSet\Services\SnaBase\Parameters\SnaDomain" and the role "HKLM\SYSTEM\CurrentControlSet\Services\SnaBase\Parameters\Role" of the target server.The Host Integration Server 2016 Management Pack uses this information to create a SNAGateway class instance.

Element properties:

TargetMicrosoft.HostIntegrationServer.2016.HISInstallations
EnabledTrue
Frequency21600
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedScript.DiscoveryProvider Default

Source Code:

<Discovery ID="Microsoft.HostIntegrationServer.2016.SNAGatewayDiscovery" Enabled="true" Target="Microsoft.HostIntegrationServer.2016.HISInstallations" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.HostIntegrationServer.2016.SNAGateway">
<Property TypeID="Microsoft.HostIntegrationServer.2016.SNAGateway" PropertyID="GWSubdomain"/>
<Property TypeID="Microsoft.HostIntegrationServer.2016.SNAGateway" PropertyID="GWServerRole"/>
<Property TypeID="Microsoft.HostIntegrationServer.2016.SNAGateway" PropertyID="GWConnectionCount"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>21600</IntervalSeconds>
<SyncTime/>
<ScriptName>HIS2016 Gateway Discovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
'--------------------------------------------------------------------------------------------------
' &lt;name&gt;HIS2016 Gateway Discovery.vbs&lt;/name&gt;
' &lt;company&gt;Microsoft Corporation&lt;/company&gt;
' &lt;copyright&gt;Copyright (c) Microsoft Corporation 2016&lt;/copyright&gt;
' &lt;summary&gt;
' Microsoft Host Integration Server 2016 Installation discovery script for use with SCOM 2016.
' Provides discovery functions for Host Integration Server 2016.
' &lt;/summary&gt;
'
' See Management Pack Guide for details on parameters and usage
'--------------------------------------------------------------------------------------------------
Option Explicit
SetLocale("en-us")
Dim oAPI, oDiscoveryData, oInst
Set oAPI = CreateObject("MOM.ScriptAPI")

Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count &lt; 3 Then
Wscript.Quit -1
End If

Dim SourceID, ManagedEntityId, TargetComputer

SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)

set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)

Dim strNetbiosName
strNetbiosName = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetbiosComputerName$"

Dim strSNASubDomain, strSNAServerRole

If IsGatewayConfigured = True then

strSNASubDomain = GetSNASubDomain
strSNAServerRole = GetSNARole

set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.HostIntegrationServer.2016.SNAGateway']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='Microsoft.HostIntegrationServer.2016.SNAGateway']/GWSubdomain$", strSNASubDomain)
call oInst.AddProperty("$MPElement[Name='Microsoft.HostIntegrationServer.2016.SNAGateway']/GWServerRole$", strSNAServerRole)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "SNA Gateway")
call oDiscoveryData.AddInstance(oInst)

End If

call oAPI.Return(oDiscoveryData)

Function IsGatewayConfigured()

CONST WMI_REG_HKLM = &amp;H80000002
CONST HIS_KEYPATH = "SOFTWARE\Microsoft\Host Integration Server\ConfiguredFeatures\NetworkIntegration"
CONST HIS_KEY = "IsEnabled"

Dim oRegProvider
Dim intReturn, strIsEnabled
strIsEnabled = "FALSE"

set oRegProvider=GetObject("winmgmts:\\" &amp; TargetComputer &amp; "\root\default:StdRegProv")

intReturn = oRegProvider.GetStringValue (WMI_REG_HKLM, HIS_KEYPATH, HIS_KEY, strIsEnabled)

if UCase(strIsEnabled) = "TRUE" then
IsGatewayconfigured = True
Else
IsGatewayconfigured = False
end if

End Function 'IsGatewayConfigured

Function GetSNASubDomain()

CONST WMI_REG_HKLM = &amp;H80000002
CONST HIS_KEYPATH = "SYSTEM\CurrentControlSet\Services\SnaBase\Parameters"
CONST HIS_KEY = "SnaDomain"

Dim oRegProvider
Dim intReturn, strValue

set oRegProvider=GetObject("winmgmts:\\" &amp; TargetComputer &amp; "\root\default:StdRegProv")

intReturn = oRegProvider.GetStringValue (WMI_REG_HKLM, HIS_KEYPATH, HIS_KEY, strValue)

if intReturn = 0 then
GetSNASubDomain = strValue
end if

End Function 'GetSNASubDomain

Function GetSNARole()

CONST WMI_REG_HKLM = &amp;H80000002
CONST HIS_KEYPATH = "SYSTEM\CurrentControlSet\Services\SnaBase\Parameters"
CONST HIS_KEY = "Role"

Dim oRegProvider
Dim intReturn, strValue

set oRegProvider=GetObject("winmgmts:\\" &amp; TargetComputer &amp; "\root\default:StdRegProv")

intReturn = oRegProvider.GetStringValue (WMI_REG_HKLM, HIS_KEYPATH, HIS_KEY, strValue)

if intReturn = 0 then
GetSNARole = strValue
end if

End Function 'GetSNARole
</Script></ScriptBody>
<TimeoutSeconds>360</TimeoutSeconds>
</DataSource>
</Discovery>