OMS Gateway PS Discovery

Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGateway.Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServerPS.Discovery2 (Discovery)

OMS Gateway PS Discovery

Element properties:

TargetMicrosoft.Windows.Computer
EnabledTrue
Frequency86400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGateway.Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServerPS.Discovery2" Target="Windows!Microsoft.Windows.Computer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer">
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="Version"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="InstallationPath"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="ListenPort"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="IncorporateScomSupport"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="IncorporateOMSSolution"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="AllowedHosts"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="AllowedClientCerts"/>
<Property TypeID="Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer" PropertyID="LogLevel"/>
<Property TypeID="System!System.ConfigItem" PropertyID="ObjectStatus"/>
<Property TypeID="System!System.ConfigItem" PropertyID="AssetStatus"/>
<Property TypeID="System!System.ConfigItem" PropertyID="Notes"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>86400</IntervalSeconds>
<SyncTime/>
<ScriptName>OMSGatewayDiscovery.ps1</ScriptName>
<ScriptBody><Script>
param($sourceId,$managedEntityID,$computerName)

If (Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService -ErrorAction SilentlyContinue){

$api = New-Object -comObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $sourceId, $managedEntityID)

$OMSGatewayVersion = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService -Name Version).Version
$OMSGatewayInstallationPath = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService -Name InstallationPath).InstallationPath
$OMSGatewayListenPort = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name ListenPort).ListenPort
$OMSGatewayIncorporateScomSupport = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name IncorporateScomSupport).IncorporateScomSupport
$OMSGatewayIncorporateOMSSolution = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name IncorporateOMSSolution).IncorporateOMSSolution
$OMSGatewayAllowedHosts = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name AllowedHosts).AllowedHosts
$OMSGatewayAllowedClientCerts = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name AllowedClientCerts).AllowedClientCerts
$OMSGatewayLogLevel = (Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Services\ForwarderService\Configurations -Name LogLevel).LogLevel

$instance = $discoveryData.CreateClassInstance("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']$")
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/Version$",$OMSGatewayVersion)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/InstallationPath$",$OMSGatewayInstallationPath)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/ListenPort$",$OMSGatewayListenPort)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/IncorporateScomSupport$",$OMSGatewayIncorporateScomSupport)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/IncorporateOMSSolution$",$OMSGatewayIncorporateOMSSolution)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/AllowedHosts$",$OMSGatewayAllowedHosts)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/AllowedClientCerts$",$OMSGatewayAllowedClientCerts)
$instance.AddProperty("$MPElement[Name='Microsoft.System.Center.Advisor.Monitoring.Addendum.OMSGatewayServer']/LogLevel$",$OMSGatewayLogLevel)
$instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$",$computerName + " (OMS Gateway Server)")
$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computerName)

$discoveryData.AddInstance($instance)
$api.LogScriptEvent("OMSGatewayDiscovery.vbs",999, 4, "Successfully discovered OMS Gateway on " + $computername)
}

$discoveryData

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>computerName</Name>
<Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
<StrictErrorHandling>false</StrictErrorHandling>
</DataSource>
</Discovery>