WIP Discovery

Microsoft.HostIntegrationServer.2016.WIPDiscovery (Discovery)

Discovery for WIP

Knowledge Base article:

Summary

The WIP discovery checks the registry location "HKLM\SOFTWARE\Microsoft\SNA Server\CurrentVersion\Monitoring\" for the existence of the “Opt-Out” key DisableWIPMonitoring. If the key exists, no further action is taken. If the key does not exist, the Host Integration Server 2016 Management Pack queries MSI to verity that the feature TRANSACTION_INTEGRATOR has been installed. If the feature is installed, the Host Integration Server 2016 Management Pack creates an instance of the WIP class.

Element properties:

TargetMicrosoft.HostIntegrationServer.2016.AppInt
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.WIPDiscovery" Enabled="true" Target="Microsoft.HostIntegrationServer.2016.AppInt" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.HostIntegrationServer.2016.WIP">
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>21600</IntervalSeconds>
<SyncTime/>
<ScriptName>HIS2016 WIP Discovery.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody><Script>
'--------------------------------------------------------------------------------------------------
' &lt;name&gt;HIS2016 WIP 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 WIP discovery script for use with SCOM 2016.
' Provides discovery functions for Host Integration Server 2016 WIP.
' &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 bDisableTN3Monitoring, bDisableTN5Monitoring, bDisablePrintMonitoring, bDisableHIPMonitoring, bDisableLU62ResyncMonitoring
Dim bDisableSIMonitoring, bDisableMIMonitoring, bDisableDIMonitoring, bDisableWIPMonitoring

bDisableTN3Monitoring = FALSE
bDisableTN5Monitoring = FALSE
bDisablePrintMonitoring = FALSE
bDisableHIPMonitoring = FALSE
bDisableLU62ResyncMonitoring = FALSE
bDisableSIMonitoring = FALSE
bDisableMIMonitoring = FALSE
bDisableDIMonitoring = FALSE
bDisableWIPMonitoring = FALSE

GetRegParams()
WIPDiscovery()

call oAPI.Return(oDiscoveryData)

Sub GetRegParams()

' Sub GetRegParams()
' Performs all registry lookups required for service discovery.

Const WMI_REG_HKLM = &amp;H80000002

Const HIS_OPTOUT_KEYPATH = "SOFTWARE\Microsoft\SNA Server\CurrentVersion\Monitoring\"
Const HIS_TN3_OPTOUT_KEY = "DisableTN3270Monitoring"
Const HIS_TN5_OPTOUT_KEY = "DisableTN5250Monitoring"
Const HIS_PRINT_OPTOUT_KEY = "DisablePrintMonitoring"
Const HIS_HIP_OPTOUT_KEY = "DisableHIPMonitoring"
Const HIS_LU62RESYNC_OPTOUT_KEY = "DisableLU62ResyncMonitoring"
Const HIS_SI_OPTOUT_KEY = "DisableSessionIntegratorMonitoring"
Const HIS_DI_OPTOUT_KEY = "DisableDataIntegrationMonitoring"
Const HIS_MI_OPTOUT_KEY = "DisableMessageIntegrationMonitoring"
Const HIS_WIP_OPTOUT_KEY = "DisableWIPMonitoring"

Dim oRegProvider
Dim intReturn
Dim colValues, strValue
Dim colTypes

' =============================================================
' Check for the possible set of monitoring opt-out keys, and for each that exists
' set the corresponding boolean variable to TRUE

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

intReturn = oRegProvider.EnumValues(WMI_REG_HKLM, HIS_OPTOUT_KEYPATH, colValues, colTypes)

If intReturn = 0 And Not (IsNull(colValues)) Then

For Each strValue In colValues

Select Case strValue

Case HIS_TN3_OPTOUT_KEY
bDisableTN3Monitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_TN5_OPTOUT_KEY
bDisableTN5Monitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_PRINT_OPTOUT_KEY
bDisablePrintMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_HIP_OPTOUT_KEY
bDisableHIPMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_LU62RESYNC_OPTOUT_KEY
bDisableLU62ResyncMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_SI_OPTOUT_KEY
bDisableSIMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_MI_OPTOUT_KEY
bDisableMIMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_DI_OPTOUT_KEY
bDisableDIMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)

Case HIS_WIP_OPTOUT_KEY
bDisableWIPMonitoring = True
'ScriptContext.Echo (strIndent2 &amp; strValue)
End Select
Next
End If

End Sub 'GetRegParams

Sub WIPDiscovery()

CONST HIS_WIP_FEATURE = "TiWip"

Dim intWIP
intWIP = 0

If NOT bDisableWIPMonitoring Then

' =============================================================
' Check for MSI feature installed
intWIP = FindFeature(HIS_WIP_FEATURE)

if NOT intWIP = 0 then
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.HostIntegrationServer.2016.WIP']$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "WIP Application")
call oDiscoveryData.AddInstance(oInst)
end if

End If

End Sub 'WIPDiscovery

Function FindFeature(strFeatureName)

' Query MSI to determine if the specified HIS feature name is installed or advertised.
' Return 1 if true, 0 if false
'
CONST HIS_2016_PRODUCT_CODE = "{283BEF3A-0848-4119-B408-FA1AE9AAFB53}"
CONST INSTALLSTATE_LOCAL = 3

dim installer, feature, features, state

set installer = CreateObject("WindowsInstaller.Installer")
set features = installer.Features(HIS_2016_PRODUCT_CODE)

for each feature in features
if feature = strFeatureName then
state = installer.FeatureState(HIS_2016_PRODUCT_CODE, feature)
if state = INSTALLSTATE_LOCAL then
FindFeature = 1
else
FindFeature = 0
end if
Exit Function
end if
next

FindFeature = 0
Exit Function

End function 'FindFeature
</Script></ScriptBody>
<TimeoutSeconds>360</TimeoutSeconds>
</DataSource>
</Discovery>