SNA Gateway Discovery
Microsoft.HostIntegrationServer.2016.SNAGatewayDiscovery (Discovery)
Discovers instances of the SNA gateway
Knowledge Base article: Element properties: Object Discovery Details: Member Modules:
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>
'--------------------------------------------------------------------------------------------------
' <name>HIS2016 Gateway Discovery.vbs</name>
' <company>Microsoft Corporation</company>
' <copyright>Copyright (c) Microsoft Corporation 2016</copyright>
' <summary>
' Microsoft Host Integration Server 2016 Installation discovery script for use with SCOM 2016.
' Provides discovery functions for Host Integration Server 2016.
' </summary>
'
' 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 < 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 = &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:\\" & TargetComputer & "\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 = &H80000002
CONST HIS_KEYPATH = "SYSTEM\CurrentControlSet\Services\SnaBase\Parameters"
CONST HIS_KEY = "SnaDomain"
Dim oRegProvider
Dim intReturn, strValue
set oRegProvider=GetObject("winmgmts:\\" & TargetComputer & "\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 = &H80000002
CONST HIS_KEYPATH = "SYSTEM\CurrentControlSet\Services\SnaBase\Parameters"
CONST HIS_KEY = "Role"
Dim oRegProvider
Dim intReturn, strValue
set oRegProvider=GetObject("winmgmts:\\" & TargetComputer & "\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>