Microsoft.KnowledgeServices.VMM.2012.VMMServer_Discovery

Microsoft.KnowledgeServices.VMM.2012.VMMServer_Discovery (Discovery)

Discovery module for class Microsoft.KnowledgeServices.VMM.2012.VMMServer

Element properties:

TargetMicrosoft.Windows.Computer
EnabledTrue
Frequency14401
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
  • Microsoft.KnowledgeServices.VMM.2012.VMMServer
    • ProductVersion
    • CompatibleMPVersion
    • AgentVersion
    • GuestAgentVersion
    • VmmID
    • VmmServiceAccount
    • VmmServicePrincipalNames
    • Port
    • IsConnected
    • ServerInterfaceVersion
    • Profile
    • UserRole
    • UserRoleId
    • FullyQualifiedDomainName
    • OpsMgrServer
    • VMRCAccessAccount
    • VMRCDefaultPort
    • VMConnectDefaultPort
    • MinimumSupportedAgentVersion
    • MinimumSupportedGuestAgentVersion
    • LibraryRefresherEnabled
    • LibraryRefresherFrequency
    • DatabaseServerName
    • DatabaseInstanceName
    • DatabaseName
    • UserName
    • CompanyName
    • ProductId
    • LicenseType
    • IsHighlyAvailable
    • FailoverVMMNodes
    • ActiveVMMNode
    • AutomaticLogicalNetworkCreationEnabled
    • AutomaticVirtualNetworkCreationEnabled
    • LogicalNetworkMatchOption
    • BackupLogicalNetworkMatchOption
    • ForOnBehalfOf
    • CEIPOptin
    • UnsupportedSQLVersion
    • VMMRelease
    • SQLRelease
    • SQLVersion
    • SQLEdition
    • BITSTcpPort
    • OSVersion
    • OSRelease
    • OSServicePack
    • InstallPath
    • TempPath
    • NumberOfManagedHosts
    • SQLProductLevel
    • EvaluationDaysLeft

Member Modules:

ID Module Type TypeId RunAs 
Microsoft.KnowledgeServices.VMM.2012.VMMServer_Discovery DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Microsoft.KnowledgeServices.ElevatedAccount.VMM

Source Code:

<Discovery ID="Microsoft.KnowledgeServices.VMM.2012.VMMServer_Discovery" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer">
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="ProductVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="CompatibleMPVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="AgentVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="GuestAgentVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VmmID"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VmmServiceAccount"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VmmServicePrincipalNames"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="Port"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="IsConnected"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="ServerInterfaceVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="Profile"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="UserRole"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="UserRoleId"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="FullyQualifiedDomainName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="OpsMgrServer"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VMRCAccessAccount"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VMRCDefaultPort"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VMConnectDefaultPort"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="MinimumSupportedAgentVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="MinimumSupportedGuestAgentVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="LibraryRefresherEnabled"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="LibraryRefresherFrequency"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="DatabaseServerName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="DatabaseInstanceName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="DatabaseName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="UserName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="CompanyName"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="ProductId"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="LicenseType"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="IsHighlyAvailable"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="FailoverVMMNodes"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="ActiveVMMNode"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="AutomaticLogicalNetworkCreationEnabled"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="AutomaticVirtualNetworkCreationEnabled"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="LogicalNetworkMatchOption"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="BackupLogicalNetworkMatchOption"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="ForOnBehalfOf"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="CEIPOptin"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="UnsupportedSQLVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="VMMRelease"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="SQLRelease"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="SQLVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="SQLEdition"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="BITSTcpPort"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="OSVersion"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="OSRelease"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="OSServicePack"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="InstallPath"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="TempPath"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="NumberOfManagedHosts"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="SQLProductLevel"/>
<Property TypeID="MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer" PropertyID="EvaluationDaysLeft"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="Microsoft.KnowledgeServices.VMM.2012.VMMServer_Discovery" RunAs="KnowledgeServices!Microsoft.KnowledgeServices.ElevatedAccount.VMM" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>14401</IntervalSeconds>
<SyncTime/>
<ScriptName>VMMServer.ps1</ScriptName>
<ScriptBody><Script>

param($SourceId,$ManagedEntityId)

$ErrorActionPreference = "Stop"


function _AdvisorGetTypedValue()
{
param([string] $type, [string] $v)
if (($type -eq "String") -or ($v -eq $null) )
{
return $v
}
if ($v.Trim().Length -gt 0)
{
switch ($type)
{
"Boolean" { if ($v -eq "true") {$true} else {$false} }
"DateTime" { [System.DateTime]::Parse($v) }
"Guid" { New-Object System.Guid($v) }
"Integer" { [int]$v }
"Float" { [float]$v }
}
}
else
{
$null
}
}
function _AdvisorAddProperty()
{
param([object]$o, [string]$p, [object]$v, [bool]$key)
if (($key -eq $true) -and ($v -eq $null))
{
Throw "Key property [$p] cannot be null."
}
if ($v -ne $null)
{
$o.AddProperty($p, $v)
}
}
function _AdvisorCreateBaseObject([string] $className, [string] $displayName)
{
$o = new-object PSObject
$o | Add-Member -MemberType NoteProperty -Name "ClassName" -Value $className
$o | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $displayName
$o | Add-Member -MemberType NoteProperty -Name "ParentClass" -Value $null
return $o
}


$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "SourceId" $SourceId
$scriptargs | add-member NoteProperty "ManagedEntityId" $ManagedEntityId


if (!$global:AdvisorEmulateRuntime)
{
$oAPI = new-object -comObject "MOM.ScriptAPI"
}


$discovery = New-Object PSObject
$discovery | Add-Member -MemberType NoteProperty -Name "_logFile" -Value $null
$discovery | Add-Member -MemberType NoteProperty -Name "_scomAPI" -Value $oAPI
$discovery | Add-Member -MemberType NoteProperty -Name "_discoveryData" -Value $null
$discovery | Add-Member -MemberType NoteProperty -Name "ParentClass" -Value $null
$discovery | Add-Member -MemberType NoteProperty -Name "Classes" -Value @()
$discovery | Add-Member -MemberType ScriptMethod -Name "AddInstance" -Value {
$o = $args[0]
$this.WriteDiscoveryDebugLog( "-Instance Added-", $o )
$this.Classes += $o
}
$discovery | Add-Member -MemberType ScriptMethod -Name "WriteEventLog" -Value {
$text = $args[0]
$eventId = $args[1]
$sev = $args[2]
if (($sev -eq $null) -or ($sev -gt 4)) { $sev = 0 }
if (($eventId -eq $null) -or ($eventId -lt 0) -or ($eventId -gt 20000)) { $eventId = 19000 }
if ($global:AdvisorEmulateRuntime)
{
Write-Debug "[Advisor Script(EventLog): Microsoft.KnowledgeServices.VMM.2012.VMMServer] ""$text"" $sev $eventId"
}
else
{
$this._scomAPI.LogScriptEvent("Advisor Script: Microsoft.KnowledgeServices.VMM.2012.VMMServer", $eventId, $sev, $text)
}
}
$discovery | Add-Member -MemberType ScriptMethod -Name "WriteDiscoveryDebugLog" -Value {
$u = [Environment]::UserDomainName + "\" + [Environment]::UserName
$date = Get-Date
$header = "$date`tMicrosoft.KnowledgeServices.VMM.2012.VMMServer`t$u"
if (($args -ne $null) -and ($args.Count -gt 0) -and ($args[0] -is [string]))
{
$header += "`t" + $args[0]
$args = @($args | Select-Object -Last ($args.Count-1))
}
$output = @($header, $args)
$output | Out-String -Width 256 | Write-Debug
if ($this._logFile -ne $null)
{
$output | Out-String | Add-Content -Path $this._logFile
}
}
$discovery | Add-Member -MemberType ScriptMethod -Name "CreateClassInstance" -Value {
return AdvisorCreateClassInstance "Microsoft.KnowledgeServices.VMM.2012.VMMServer"
}

$discoveryDebugFilePath = Join-Path $Env:ProgramFiles "\System Center Advisor\discovery.txt"
if (Test-Path $discoveryDebugFilePath)
{
$discovery._logFile = $discoveryDebugFilePath
}
del variable:\discoveryDebugFilePath -force &#x2013;ErrorAction SilentlyContinue

$discovery | Add-Member -MemberType ScriptMethod -Name "CreateDiscoveryData" -Value {
if ($global:AdvisorEmulateRuntime)
{
$i = 0
foreach ($o in $this.Classes)
{
$i = $i + 1
$this.WriteDiscoveryDebugLog("Discovered Class $i", $o )
}
}
else
{
$this._discoveryData = $this._scomAPI.CreateDiscoveryData(0, $scriptargs.SourceId, $scriptargs.ManagedEntityId)
foreach ($o in $this.Classes)
{
$instance = $null
switch ($o.ClassName)
{
"Microsoft.KnowledgeServices.VMM.2012.VMMServer"
{
$instance = $this._discoveryData.CreateClassInstance("$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']$")

_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/ProductVersion$" $o.ProductVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/CompatibleMPVersion$" $o.CompatibleMPVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/AgentVersion$" $o.AgentVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/GuestAgentVersion$" $o.GuestAgentVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VmmID$" $o.VmmID $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VmmServiceAccount$" $o.VmmServiceAccount $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VmmServicePrincipalNames$" $o.VmmServicePrincipalNames $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/Port$" $o.Port $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/IsConnected$" $o.IsConnected $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/ServerInterfaceVersion$" $o.ServerInterfaceVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/Profile$" $o.Profile $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/UserRole$" $o.UserRole $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/UserRoleId$" $o.UserRoleId $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/FullyQualifiedDomainName$" $o.FullyQualifiedDomainName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/OpsMgrServer$" $o.OpsMgrServer $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VMRCAccessAccount$" $o.VMRCAccessAccount $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VMRCDefaultPort$" $o.VMRCDefaultPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VMConnectDefaultPort$" $o.VMConnectDefaultPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/MinimumSupportedAgentVersion$" $o.MinimumSupportedAgentVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/MinimumSupportedGuestAgentVersion$" $o.MinimumSupportedGuestAgentVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/LibraryRefresherEnabled$" $o.LibraryRefresherEnabled $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/LibraryRefresherFrequency$" $o.LibraryRefresherFrequency $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/DatabaseServerName$" $o.DatabaseServerName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/DatabaseInstanceName$" $o.DatabaseInstanceName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/DatabaseName$" $o.DatabaseName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/UserName$" $o.UserName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/CompanyName$" $o.CompanyName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/ProductId$" $o.ProductId $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/LicenseType$" $o.LicenseType $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/IsHighlyAvailable$" $o.IsHighlyAvailable $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/FailoverVMMNodes$" $o.FailoverVMMNodes $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/ActiveVMMNode$" $o.ActiveVMMNode $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/AutomaticLogicalNetworkCreationEnabled$" $o.AutomaticLogicalNetworkCreationEnabled $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/AutomaticVirtualNetworkCreationEnabled$" $o.AutomaticVirtualNetworkCreationEnabled $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/LogicalNetworkMatchOption$" $o.LogicalNetworkMatchOption $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/BackupLogicalNetworkMatchOption$" $o.BackupLogicalNetworkMatchOption $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/ForOnBehalfOf$" $o.ForOnBehalfOf $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/CEIPOptin$" $o.CEIPOptin $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/UnsupportedSQLVersion$" $o.UnsupportedSQLVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/VMMRelease$" $o.VMMRelease $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/SQLRelease$" $o.SQLRelease $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/SQLVersion$" $o.SQLVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/SQLEdition$" $o.SQLEdition $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/BITSTcpPort$" $o.BITSTcpPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/OSVersion$" $o.OSVersion $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/OSRelease$" $o.OSRelease $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/OSServicePack$" $o.OSServicePack $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/InstallPath$" $o.InstallPath $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/TempPath$" $o.TempPath $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/NumberOfManagedHosts$" $o.NumberOfManagedHosts $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/SQLProductLevel$" $o.SQLProductLevel $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesVMM2012Library!Microsoft.KnowledgeServices.VMM.2012.VMMServer']/EvaluationDaysLeft$" $o.EvaluationDaysLeft $false
_AdvisorAddProperty $instance "$MPElement[Name='System!System.Entity']/DisplayName$" $o.DisplayName $false
_AdvisorAddProperty $instance "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$" $this.ParentClass.PrincipalName $true


}
default {Throw "Unsupported ClassName: " + $o.ClassName}
}
$this._discoveryData.AddInstance($instance)
}
return $this._discoveryData
}
}

function AdvisorCreateClassInstance([string] $className)
{
$o = $null
switch ($className)
{
"Microsoft.KnowledgeServices.VMM.2012.VMMServer"
{
$o = New-Object PSObject
$o | Add-Member -MemberType NoteProperty -Name ClassName -Value $className
$o | Add-Member -MemberType NoteProperty -Name DisplayName -Value "VMMServer"

$o | Add-Member -MemberType NoteProperty -Name "ProductVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CompatibleMPVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "AgentVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "GuestAgentVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VmmID" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VmmServiceAccount" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VmmServicePrincipalNames" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "Port" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "IsConnected" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ServerInterfaceVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "Profile" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "UserRole" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "UserRoleId" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "FullyQualifiedDomainName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "OpsMgrServer" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VMRCAccessAccount" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VMRCDefaultPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VMConnectDefaultPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "MinimumSupportedAgentVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "MinimumSupportedGuestAgentVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "LibraryRefresherEnabled" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "LibraryRefresherFrequency" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DatabaseServerName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DatabaseInstanceName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DatabaseName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "UserName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CompanyName" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ProductId" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "LicenseType" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "IsHighlyAvailable" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "FailoverVMMNodes" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ActiveVMMNode" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "AutomaticLogicalNetworkCreationEnabled" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "AutomaticVirtualNetworkCreationEnabled" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "LogicalNetworkMatchOption" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "BackupLogicalNetworkMatchOption" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ForOnBehalfOf" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CEIPOptin" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "UnsupportedSQLVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "VMMRelease" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "SQLRelease" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "SQLVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "SQLEdition" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "BITSTcpPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "OSVersion" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "OSRelease" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "OSServicePack" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "InstallPath" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "TempPath" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "NumberOfManagedHosts" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "SQLProductLevel" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "EvaluationDaysLeft" -Value $null -Force


}
default {Throw "Unsupported ClassName: " + $className}
}
return $o
}



$current = _AdvisorCreateBaseObject "Microsoft.Windows.Computer" ""
$current | Add-Member -MemberType NoteProperty -Name "PrincipalName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "DNSName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/DNSName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetbiosComputerName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetbiosDomainName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosDomainName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "IPAddress" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/IPAddress$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetworkName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ActiveDirectoryObjectSid" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/ActiveDirectoryObjectSid$" -Force
$current | Add-Member -MemberType NoteProperty -Name "IsVirtualMachine" -Value $null -Force;$current.IsVirtualMachine = _AdvisorGetTypedValue "Boolean" "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/IsVirtualMachine$"
$current | Add-Member -MemberType NoteProperty -Name "DomainDnsName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/DomainDnsName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "OrganizationalUnit" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/OrganizationalUnit$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ForestDnsName" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/ForestDnsName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ActiveDirectorySite" -Value "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/ActiveDirectorySite$" -Force
$current | Add-Member -MemberType NoteProperty -Name "LogicalProcessors" -Value $null -Force;$current.LogicalProcessors = _AdvisorGetTypedValue "Integer" "$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/LogicalProcessors$"
$current | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value "$Target/Property[Type="System!System.Entity"]/DisplayName$" -Force

$discovery.ParentClass = $current







$setupKeyExists = Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup"

if ($setupKeyExists)
{
$setupKey = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup"

Set-ExecutionPolicy -Scope Process RemoteSigned -Force

$modulePath = $setupKey.InstallPath + "bin\psModules\virtualmachinemanager\virtualmachinemanager.psd1";

import-module $modulePath;

Try
{
$script:config = Get-VMMServer "localhost";
}
Catch [Microsoft.VirtualManager.Utils.CarmineException]
{

return
}

$minVersion = New-Object -TypeName System.Version "3.1.3612.0";

$productVersion = New-Object -TypeName System.Version $config.ProductVersion

if ($productVersion -gt $minVersion)
{
$instance = $discovery.CreateClassInstance();

$instance.DisplayName = "VMM Server";

$instance.ProductVersion = $config.ProductVersion;
$instance.Port = $config.Port;
$instance.IsConnected = $config.IsConnected;
$instance.ServerInterfaceVersion = $config.ServerInterfaceVersion;
$instance.Profile = $config.Profile;
$instance.UserRole = $config.UserRole.ToString();
$instance.UserRoleId = $config.UserRoleId.ToString();
$instance.FullyQualifiedDomainName = $config.FullyQualifiedDomainName;
$instance.OpsMgrServer = $config.OpsMgrServer;
$instance.CEIPOptIn = $config.CEIPOptIn;
$instance.VMRCAccessAccount = $config.VMRCAccessAccount;
$instance.VMRCDefaultPort = $config.VMRCDefaultPort;
$instance.VMConnectDefaultPort = $config.VMConnectDefaultPort;
$instance.MinimumSupportedAgentVersion = $config.MinimumSupportedAgentVersion;
$instance.MinimumSupportedGuestAgentVersion = $config.MinimumSupportedGuestAgentVersion;
$instance.LibraryRefresherEnabled = $config.LibraryRefresherEnabled;
$instance.LibraryRefresherFrequency = $config.LibraryRefresherFrequency;
$instance.DatabaseServerName = $config.DatabaseServerName;
$instance.DatabaseInstanceName = $config.DatabaseInstanceName;
$instance.DatabaseName = $config.DatabaseName;
$instance.UserName = $config.UserName;
$instance.CompanyName = $config.CompanyName;
$instance.ProductId = $config.ProductId;
$instance.LicenseType = $config.LicenseType.ToString();
$instance.EvaluationDaysLeft = $config.EvaluationDaysLeft;
$instance.IsHighlyAvailable = $config.IsHighlyAvailable;
$instance.AutomaticLogicalNetworkCreationEnabled = $config.AutomaticLogicalNetworkCreationEnabled;
$instance.AutomaticVirtualNetworkCreationEnabled = $config.AutomaticVirtualNetworkCreationEnabled;
$instance.LogicalNetworkMatchOption = $config.LogicalNetworkMatchOption.ToString();
$instance.BackupLogicalNetworkMatchOption = $config.BackupLogicalNetworkMatchOption.ToString();
$instance.ForOnBehalfOf = $config.ForOnBehalfOf;
$instance.FailoverVMMNodes = [System.String]::Join(", ", @($config.FailoverVMMNodes));
$instance.ActiveVMMNode = $config.ActiveVMMNode;



$instance.CompatibleMPVersion = $setupKey.CompatibleMPVersion;
$instance.AgentVersion = $setupKey.AgentVersion;
$instance.GuestAgentVersion = $setupKey.GuestAgentVersion;
$instance.VmmID = $setupKey.VmmID;
$instance.VmmServiceAccount = $setupKey.VmmServiceAccount;
$instance.VmmServicePrincipalNames = $setupKey.VmmServicePrincipalNames;
$instance.InstallPath = $setupKey.InstallPath
$instance.TempPath = $setupKey.TempPath



$settingsKey = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings"
$instance.BITSTcpPort = $settingsKey.BITSTcpPort;



$instance.NumberOfManagedHosts = (Get-VMHost).Count;



$serverOS = Get-WmiObject -Class "Win32_OperatingSystem"
$instance.OSVersion = $serverOS.Version









$parsedOSVersion = New-Object -TypeName System.Version $serverOS.Version
$instance.OSServicePack = 0;

if ($parsedOSVersion.Major -eq 6)
{
if ($parsedOSVersion.Minor -eq 0)
{
$instance.OSRelease = "2008";
}
elseif ($parsedOSVersion.Minor -eq 1)
{
$instance.OSRelease = "2008R2";
if ($parsedOSVersion.Build -eq 7601)
{
$instance.OSServicePack = 1;
}
}
elseif ($parsedOSVersion.Minor -eq 2)
{
$instance.OSRelease = "2012";
}
elseif ($parsedOSVersion.Minor -eq 3)
{
$instance.OSRelease = "2012R2";
}
}
else
{
$instance.OSRelease = "Unknown";
}



$instance.SQLRelease = "Unknown";
$instance.SQLVersion = "Unknown";
$instance.SQLEdition = "Unknown";
$instance.SQLProductLevel = "Unknown";

try
{
$connectionString = "Server=" + $config.DatabaseInstanceName + "; Database=" + $config.DatabaseName + "; Trusted_Connection=True;"

$cmd = "SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('edition'), SERVERPROPERTY('productlevel')";

$da = new-object System.Data.SqlClient.SqlDataAdapter($cmd, $connectionString);

$dt = new-object System.Data.DataTable;

$da.fill($dt) | out-null;

$instance.SQLVersion = $dt.Column1;
$instance.SQLEdition = $dt.Column2;
$instance.SQLProductLevel = $dt.Column3;



$cmd = "exec sys.sp_server_info 2";

$da = new-object System.Data.SqlClient.SqlDataAdapter($cmd, $connectionString);

$dt = new-object System.Data.DataTable;

$da.fill($dt) | out-null;

$s = $dt.attribute_value;

$instance.SQLRelease = $s.Split("-")[0].TrimEnd(" ");
}
catch
{
}



$VMMVersion = New-Object -TypeName System.Version $instance.ProductVersion


$instance.VMMRelease = "Unknown";

$vmmVersionMap = @(
@{ Version=New-Object -TypeName System.Version "3.1.3612.0"; Release="VMM 2012 SP1 (Beta)"; },
@{ Version=New-Object -TypeName System.Version "3.1.5016.0"; Release="VMM 2012 SP1 (RC)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6011.0"; Release="VMM 2012 SP1 (RTM)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6018.0"; Release="VMM 2012 SP1 (UR1)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6020.0"; Release="VMM 2012 SP1 (UR2)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6027.0"; Release="VMM 2012 SP1 (UR3)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6032.0"; Release="VMM 2012 SP1 (UR4)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6038.0"; Release="VMM 2012 SP1 (UR5)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6046.0"; Release="VMM 2012 SP1 (UR6)"; },
@{ Version=New-Object -TypeName System.Version "3.1.6084.0"; Release="VMM 2012 SP1 (UR7)"; },
@{ Version=New-Object -TypeName System.Version "3.1.7183.0"; Release="VMM 2012 R2 (Beta)"; },
@{ Version=New-Object -TypeName System.Version "3.1.7200.0"; Release="VMM 2012 R2 (Preview)"; },
@{ Version=New-Object -TypeName System.Version "3.2.7510.0"; Release="VMM 2012 R2 (RTM)"; }
@{ Version=New-Object -TypeName System.Version "3.2.7620.0"; Release="VMM 2012 R2 (UR1)"; }
@{ Version=New-Object -TypeName System.Version "3.2.7634.0"; Release="VMM 2012 R2 (UR2)"; }
@{ Version=New-Object -TypeName System.Version "3.2.7672.0"; Release="VMM 2012 R2 (UR3)"; }
);


foreach ($v in $vmmVersionMap)
{
if ($v.Version -eq $VMMVersion)
{
$instance.VMMRelease = $v.Release;
}
}

if ($instance.VMMRelease -ieq "Unknown")
{
$vmm2012SP1UR7Version = New-Object -TypeName System.Version "3.1.6084.0";
$vmm2012SP1UpVersion = New-Object -TypeName System.Version "3.1.7000.0";
$vmm2012R2BetaVersion = New-Object -TypeName System.Version "3.1.7183.0";
if ($VMMVersion -gt $vmm2012SP1UR4Version -And $VMMVersion -lt $vmm2012SP1UpVersion)
{
$instance.VMMRelease = "VMM 2012 SP1";
}
elseif ($VMMVersion -gt $vmm2012R2BetaVersion)
{
$instance.VMMRelease = "VMM 2012 R2";
}
}







$instance.UnsupportedSQLVersion = $true

if ($instance.VMMRelease.StartsWith("VMM 2012 SP1"))
{
if ($instance.SQLRelease -eq "Microsoft SQL Server 2008 R2" -and
($instance.SQLProductLevel -eq "SP1" -or $instance.SQLProductLevel -eq "SP2"))
{
if ($instance.SQLEdition.StartsWith("Standard Edition") -or
$instance.SQLEdition.StartsWith("Enterprise Edition") -or
$instance.SQLEdition.StartsWith("Datacenter Edition"))
{
$instance.UnsupportedSQLVersion = $false
}
}
elseif ($instance.SQLRelease -eq "Microsoft SQL Server 2012")
{
if ($instance.SQLEdition.StartsWith("Standard Edition") -or $instance.SQLEdition.StartsWith("Enterprise Edition"))
{
$instance.UnsupportedSQLVersion = $false
}
}
}
elseif ($instance.VMMRelease.StartsWith("VMM 2012 R2"))
{
if ($instance.SQLRelease -eq "Microsoft SQL Server 2008 R2" -and $instance.SQLProductLevel -eq "SP2")
{
if ($instance.SQLEdition.StartsWith("Standard Edition") -or $instance.SQLEdition.StartsWith("Datacenter Edition"))
{
$instance.UnsupportedSQLVersion = $false
}
}
elseif ($instance.SQLRelease -eq "Microsoft SQL Server 2012")
{
if ($instance.SQLEdition.StartsWith("Standard Edition") -or $instance.SQLEdition.StartsWith("Enterprise Edition"))
{
$instance.UnsupportedSQLVersion = $false
}
}
}

$discovery.AddInstance($instance)
}
}


$discoverydata = $discovery.CreateDiscoveryData()
$discoverydata

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>SourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>ManagedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
<StrictErrorHandling>false</StrictErrorHandling>
</DataSource>
</Discovery>