WUGSQLDiscovery

Bostwick.WUG.WUGSQLDiscovery (Discovery)

Discovers WUG SQL Servers from the WUG Database settings

Element properties:

TargetBostwick.WUG.WUGServerClass
EnabledTrue
Frequency7200
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
Discovered relationships and their attribuets:

Member Modules:

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

Source Code:

<Discovery ID="Bostwick.WUG.WUGSQLDiscovery" Target="Bostwick.WUG.WUGServerClass" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Bostwick.WUG.WUGServerClass">
<Property TypeID="Bostwick.WUG.WUGServerClass" PropertyID="WUGVersion"/>
<Property TypeID="Bostwick.WUG.WUGServerClass" PropertyID="WUGSQLServer"/>
<Property TypeID="Bostwick.WUG.WUGServerClass" PropertyID="SerialNumber"/>
<Property TypeID="Bostwick.WUG.WUGServerClass" PropertyID="WUGType"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryClass TypeID="Bostwick.WUG.WUGSQLServerClass">
<Property TypeID="Bostwick.WUG.WUGSQLServerClass" PropertyID="WUGDB"/>
<Property TypeID="Bostwick.WUG.WUGSQLServerClass" PropertyID="WUGDataSource"/>
<Property TypeID="Bostwick.WUG.WUGSQLServerClass" PropertyID="WUGServer"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
<DiscoveryRelationship TypeID="Bostwick.WUG.WUGServerContainsSeed"/>
<DiscoveryRelationship TypeID="Bostwick.WUG.WUGSQLServerClassRelationship"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>7200</IntervalSeconds>
<SyncTime/>
<ScriptName>WUG_SQL_DISCOVERY1.ps1</ScriptName>
<ScriptBody><Script>
param(
[string]$SourceId,
[string]$ManagedEntityId,
[string]$TargetComputer
)

$oAPI = new-object -comObject "MOM.ScriptAPI"
$Discovery = $oAPI.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)

$Domain = [string]([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).name
$key = get-itemproperty "hklm:software\wow6432node\ipswitch\network monitor\whatsup engine\database settings"
$wugsql = [string]((($key.datasource_whatsUp) -split {$_ -eq '=' -or $_ -eq '\'})[1]+"."+$Domain)
$wugdb = [string](($key.datasource_whatsUp) -split {$_ -eq '=' -or $_ -eq '\' -or $_ -eq ';'})[4]
$wugDataSource = [string]$key.datasource_whatsUp
$key = get-itemproperty "hklm:software\wow6432node\ipswitch\network monitor\whatsup Gold"
$wugSerial = $key.Serialnumber
$key = get-itemproperty "hklm:software\wow6432node\ipswitch\network monitor\whatsup Gold\setup"
$wugversion = $key.displayversion
$type = "Unknown"
if($wugdb -like "*WUGC*"){
$type = "Central"}
Elseif($wugdb -like "*WUGR*"){
$type = "Remote"}
Else{}

$Instance = $Discovery.CreateClassInstance("$MPElement[Name='Bostwick.WUG.WUGSQLServerClass']$")
$Instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $wugsql)
$Instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $wugsql)
$Instance.AddProperty("$MPElement[Name='Bostwick.WUG.WUGSQLServerClass']/WUGDB$", $wugdb)
$Instance.AddProperty("$MPElement[Name='Bostwick.WUG.WUGSQLServerClass']/WUGDataSource$", $wugDataSource)
$Instance.AddProperty("$MPElement[Name='Bostwick.WUG.WUGSQLServerClass']/WUGServer$", $TargetComputer)


$Instance2 = $Discovery.CreateClassInstance("$MPElement[Name='Bostwick.WUG.WUGServerClass']$")
$Instance2.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $TargetComputer)
$Instance2.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $TargetComputer)
$Instance2.AddProperty("$MPElement[Name='Bostwick.WUG.WUGServerClass']/WUGVersion$", $wugversion)
$Instance2.AddProperty("$MPElement[Name='Bostwick.WUG.WUGServerClass']/WUGSQLServer$", $wugsql)
$Instance2.AddProperty("$MPElement[Name='Bostwick.WUG.WUGServerClass']/SerialNumber$", $wugSerial)
$Instance2.AddProperty("$MPElement[Name='Bostwick.WUG.WUGServerClass']/WUGType$", $type)
$Discovery.AddInstance($Instance)
$Discovery.AddInstance($Instance2)
$Discovery

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>SourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>ManagedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>TargetComputer</Name>
<Value>$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>170</TimeoutSeconds>
</DataSource>
</Discovery>