Microsoft.KnowledgeServices.Lync.2010.WebServerInfo_Discovery

Microsoft.KnowledgeServices.Lync.2010.WebServerInfo_Discovery (Discovery)

Discovery module for class Microsoft.KnowledgeServices.Lync.2010.WebServerInfo

Element properties:

TargetMicrosoft.KnowledgeServices.Lync.2010.CsServer
EnabledTrue
Frequency14400
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:
  • Microsoft.KnowledgeServices.Lync.2010.WebServerInfo
    • Identity
    • PrimaryHttpPort
    • PrimaryHttpsPort
    • ExternalHttpPort
    • ExternalHttpsPort
    • PublishedHttpPort
    • PublishedHttpsPort
    • PublishedExternalHttpPort
    • PublishedExternalHttpsPort
    • ReachPrimaryPSOMServerPort
    • ReachExternalPSOMServerPort
    • AppSharingPortStart
    • AppSharingPortCount
    • LiserviceInternalURI
    • ABHandlerInternalURI
    • ABHandlerExternalURI
    • DLExpansionInternalURI
    • DLExpansionExternalURI
    • CAHandlerInternalURI
    • CAHandlerExternalURI
    • CollabContentInternalURI
    • CollabContentExternalURI
    • CAHandlerInternalAnonURI
    • DeviceUpdateDownloadInternalUri
    • deviceUpdateDownloadExternalUri
    • DeviceUpdateStoreInternalUri
    • DeviceUpdateStoreExternalUri
    • RgsAgentServiceInternalUri
    • RgsAgentServiceExternalUri
    • MeetingExternalUri
    • DialinExternalUri
    • CscpInternalUri
    • ReachExternalUri
    • ReachInternalUri
    • WebTicketExternalUri
    • WebTicketInternalUri
    • ExternalFqdn
    • InternalFqdn

Member Modules:

ID Module Type TypeId RunAs 
Microsoft.KnowledgeServices.Lync.2010.WebServerInfo_Discovery DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Microsoft.KnowledgeServices.ElevatedAccount

Source Code:

<Discovery ID="Microsoft.KnowledgeServices.Lync.2010.WebServerInfo_Discovery" Enabled="true" Target="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo">
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="Identity"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PrimaryHttpPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PrimaryHttpsPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ExternalHttpPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ExternalHttpsPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PublishedHttpPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PublishedHttpsPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PublishedExternalHttpPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="PublishedExternalHttpsPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ReachPrimaryPSOMServerPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ReachExternalPSOMServerPort"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="AppSharingPortStart"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="AppSharingPortCount"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="LiserviceInternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ABHandlerInternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ABHandlerExternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DLExpansionInternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DLExpansionExternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CAHandlerInternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CAHandlerExternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CollabContentInternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CollabContentExternalURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CAHandlerInternalAnonURI"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DeviceUpdateDownloadInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="deviceUpdateDownloadExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DeviceUpdateStoreInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DeviceUpdateStoreExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="RgsAgentServiceInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="RgsAgentServiceExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="MeetingExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="DialinExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="CscpInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ReachExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ReachInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="WebTicketExternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="WebTicketInternalUri"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="ExternalFqdn"/>
<Property TypeID="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo" PropertyID="InternalFqdn"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="Microsoft.KnowledgeServices.Lync.2010.WebServerInfo_Discovery" RunAs="KnowledgeServices!Microsoft.KnowledgeServices.ElevatedAccount" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>14400</IntervalSeconds>
<SyncTime/>
<ScriptName>WebServerInfo.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.Lync.2010.WebServerInfo] ""$text"" $sev $eventId"
}
else
{
$this._scomAPI.LogScriptEvent("Advisor Script: Microsoft.KnowledgeServices.Lync.2010.WebServerInfo", $eventId, $sev, $text)
}
}
$discovery | Add-Member -MemberType ScriptMethod -Name "WriteDiscoveryDebugLog" -Value {
$u = [Environment]::UserDomainName + "\" + [Environment]::UserName
$date = Get-Date
$header = "$date`tMicrosoft.KnowledgeServices.Lync.2010.WebServerInfo`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.Lync.2010.WebServerInfo"
}

$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.Lync.2010.WebServerInfo"
{
$instance = $this._discoveryData.CreateClassInstance("$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']$")

_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/Identity$" $o.Identity $true
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PrimaryHttpPort$" $o.PrimaryHttpPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PrimaryHttpsPort$" $o.PrimaryHttpsPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ExternalHttpPort$" $o.ExternalHttpPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ExternalHttpsPort$" $o.ExternalHttpsPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PublishedHttpPort$" $o.PublishedHttpPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PublishedHttpsPort$" $o.PublishedHttpsPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PublishedExternalHttpPort$" $o.PublishedExternalHttpPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/PublishedExternalHttpsPort$" $o.PublishedExternalHttpsPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ReachPrimaryPSOMServerPort$" $o.ReachPrimaryPSOMServerPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ReachExternalPSOMServerPort$" $o.ReachExternalPSOMServerPort $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/AppSharingPortStart$" $o.AppSharingPortStart $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/AppSharingPortCount$" $o.AppSharingPortCount $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/LiserviceInternalURI$" $o.LiserviceInternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ABHandlerInternalURI$" $o.ABHandlerInternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ABHandlerExternalURI$" $o.ABHandlerExternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DLExpansionInternalURI$" $o.DLExpansionInternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DLExpansionExternalURI$" $o.DLExpansionExternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CAHandlerInternalURI$" $o.CAHandlerInternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CAHandlerExternalURI$" $o.CAHandlerExternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CollabContentInternalURI$" $o.CollabContentInternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CollabContentExternalURI$" $o.CollabContentExternalURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CAHandlerInternalAnonURI$" $o.CAHandlerInternalAnonURI $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DeviceUpdateDownloadInternalUri$" $o.DeviceUpdateDownloadInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/deviceUpdateDownloadExternalUri$" $o.deviceUpdateDownloadExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DeviceUpdateStoreInternalUri$" $o.DeviceUpdateStoreInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DeviceUpdateStoreExternalUri$" $o.DeviceUpdateStoreExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/RgsAgentServiceInternalUri$" $o.RgsAgentServiceInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/RgsAgentServiceExternalUri$" $o.RgsAgentServiceExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/MeetingExternalUri$" $o.MeetingExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/DialinExternalUri$" $o.DialinExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/CscpInternalUri$" $o.CscpInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ReachExternalUri$" $o.ReachExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ReachInternalUri$" $o.ReachInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/WebTicketExternalUri$" $o.WebTicketExternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/WebTicketInternalUri$" $o.WebTicketInternalUri $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/ExternalFqdn$" $o.ExternalFqdn $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.WebServerInfo']/InternalFqdn$" $o.InternalFqdn $false
_AdvisorAddProperty $instance "$MPElement[Name='System!System.Entity']/DisplayName$" $o.DisplayName $false
_AdvisorAddProperty $instance "$MPElement[Name='MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer']/ReplicaFqdn$" $this.ParentClass.ReplicaFqdn $true
_AdvisorAddProperty $instance "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$" $this.ParentClass.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.Lync.2010.WebServerInfo"
{
$o = New-Object PSObject
$o | Add-Member -MemberType NoteProperty -Name ClassName -Value $className
$o | Add-Member -MemberType NoteProperty -Name DisplayName -Value "Lync Web Server Information"

$o | Add-Member -MemberType NoteProperty -Name "Identity" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PrimaryHttpPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PrimaryHttpsPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ExternalHttpPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ExternalHttpsPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PublishedHttpPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PublishedHttpsPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PublishedExternalHttpPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "PublishedExternalHttpsPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ReachPrimaryPSOMServerPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ReachExternalPSOMServerPort" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "AppSharingPortStart" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "AppSharingPortCount" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "LiserviceInternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ABHandlerInternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ABHandlerExternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DLExpansionInternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DLExpansionExternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CAHandlerInternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CAHandlerExternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CollabContentInternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CollabContentExternalURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CAHandlerInternalAnonURI" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DeviceUpdateDownloadInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "deviceUpdateDownloadExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DeviceUpdateStoreInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DeviceUpdateStoreExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "RgsAgentServiceInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "RgsAgentServiceExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "MeetingExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "DialinExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "CscpInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ReachExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ReachInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "WebTicketExternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "WebTicketInternalUri" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "ExternalFqdn" -Value $null -Force
$o | Add-Member -MemberType NoteProperty -Name "InternalFqdn" -Value $null -Force


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



$current = _AdvisorCreateBaseObject "Microsoft.KnowledgeServices.Lync.2010.CsServer" ""
$current | Add-Member -MemberType NoteProperty -Name "ServerVersion" -Value "$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer"]/ServerVersion$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ReplicaFqdn" -Value "$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer"]/ReplicaFqdn$" -Force
$current | Add-Member -MemberType NoteProperty -Name "UpToDate" -Value $null -Force;$current.UpToDate = _AdvisorGetTypedValue "Boolean" "$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer"]/UpToDate$"
$current | Add-Member -MemberType NoteProperty -Name "Pool" -Value "$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer"]/Pool$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ServerLicense" -Value "$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CsServer"]/ServerLicense$" -Force
$current | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value "$Target/Property[Type="System!System.Entity"]/DisplayName$" -Force

$discovery.ParentClass = $current
$current = _AdvisorCreateBaseObject "Microsoft.Windows.Computer" ""
$current | Add-Member -MemberType NoteProperty -Name "PrincipalName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "DNSName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/DNSName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetbiosComputerName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosComputerName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetbiosDomainName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetbiosDomainName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "IPAddress" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/IPAddress$" -Force
$current | Add-Member -MemberType NoteProperty -Name "NetworkName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ActiveDirectoryObjectSid" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/ActiveDirectoryObjectSid$" -Force
$current | Add-Member -MemberType NoteProperty -Name "IsVirtualMachine" -Value $null -Force;$current.IsVirtualMachine = _AdvisorGetTypedValue "Boolean" "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/IsVirtualMachine$"
$current | Add-Member -MemberType NoteProperty -Name "DomainDnsName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/DomainDnsName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "OrganizationalUnit" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/OrganizationalUnit$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ForestDnsName" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/ForestDnsName$" -Force
$current | Add-Member -MemberType NoteProperty -Name "ActiveDirectorySite" -Value "$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/ActiveDirectorySite$" -Force
$current | Add-Member -MemberType NoteProperty -Name "LogicalProcessors" -Value $null -Force;$current.LogicalProcessors = _AdvisorGetTypedValue "Integer" "$Target/Host/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.ParentClass = $current



[ScriptBlock]$mainScriptBlock = {
$script:lyncPath = ""
if (Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1" | Test-Path)
{
$script:lyncPath = Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1"
$script:lyncPSVer = 2013
}
elseif (Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1" | Test-Path)
{
$script:lyncPath = Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1"
$script:lyncPSVer = 2010
}
$ScriptEnv = new-object psobject
$ScriptEnv | add-member ScriptMethod "ImportLyncPSModule" -value {
$m = Get-Module -Name Lync
if ($m -eq $null)
{
Import-Module $script:lyncPath -ErrorAction:SilentlyContinue
}
}
$ScriptEnv | Add-Member ScriptMethod "IsCMSMaster" -Value {
Try
{
$cmsStatus = Get-CsManagementStoreReplicationStatus -CentralManagementStoreStatus
$agentHostFqdn = [System.Net.Dns]::GetHostByName([System.Net.Dns]::GetHostName()).HostName
return $cmsStatus.ActiveMasterFqdn -ieq $agentHostFqdn
}
Catch [Microsoft.Rtc.Management.ADConnect.CannotGetDomainInfoException]
{
}
Catch [Microsoft.Rtc.Common.Data.SqlConnectionException]
{
}
Catch [System.Data.SqlClient.SqlException]
{
}
return $false
}


$ScriptEnv | Add-Member ScriptMethod "GetCsWebServerInfo" -value {
Get-CsService -WebServer
}


if ($script:lyncPath -ne "")
{
$ScriptEnv.ImportLyncPSModule()
if (-Not $ScriptEnv.IsCMSMaster())
{
return
}

$global:advisorDiscoveredObjects = $ScriptEnv.GetCsWebServerInfo()
}

}

Function Test-NeedPSRemoting
{
$script:lyncPSVer = 0
if (Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2013\Modules\Lync\Lync.psd1" | Test-Path)
{
$script:lyncPSVer = 2013
}
elseif (Join-Path $Env:CommonProgramFiles "\Microsoft Lync Server 2010\Modules\Lync\Lync.psd1" | Test-Path)
{
$script:lyncPSVer = 2010
}
$PSCLRVersion = [System.String]::Format("{0}.{1}", $PSVersionTable.CLRVersion.Major, $PSVersionTable.CLRVersion.Minor)
if (($PSCLRVersion -ieq "2.0") -and ($script:lyncPSVer -ieq 2013))
{
return $true
}
return $false
}

if ((Test-NeedPSRemoting))
{
[bool]$script:psRemotingEnabled = $false

$winRMService = (Get-Service WinRM -ErrorAction SilentlyContinue)
if ($winRMService -ne $null)
{
if ($winRMService.Status -ieq [System.ServiceProcess.ServiceControllerStatus]::Stopped)
{
$winRMService.Start()
$winRMService.WaitForStatus([System.ServiceProcess.ServiceControllerStatus]::Running, [System.TimeSpan]::FromSeconds(15))
}
$psSessionConfiguration = (Get-PSSessionConfiguration -Name "Microsoft.PowerShell" -ErrorAction SilentlyContinue)
if ($psSessionConfiguration.SecurityDescriptorSddl -ieq "O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)")
{
winrm quickconfig -quiet
$script:psRemotingEnabled = $true
}
else
{


}
}


if ($script:psRemotingEnabled -eq $true)
{
$session = New-PSSession
Invoke-Command -Session $session -ScriptBlock $mainScriptBlock
$global:advisorDiscoveredObjects = Invoke-Command -Session $session -ScriptBlock {$global:advisorDiscoveredObjects}
Remove-PSSession -Session $session
}
}
else
{
&amp; $mainScriptBlock
}

Function AddDiscoveryInstance($discoveredObjects)
{
Function ObjToStr($obj)
{
if ($obj -ne $null)
{
$obj.ToString()
}
else
{
$obj
}
}

foreach ($item in $discoveredObjects)
{
$WebServerInfo = $discovery.CreateClassInstance()
$WebServerInfo.Identity = $item.Identity
$WebServerInfo.PrimaryHttpPort = $item.PrimaryHttpPort
$WebServerInfo.PrimaryHttpsPort = $item.PrimaryHttpsPort
$WebServerInfo.ExternalHttpPort = $item.ExternalHttpPort
$WebServerInfo.ExternalHttpsPort = $item.ExternalHttpsPort
$WebServerInfo.PublishedHttpPort = $item.PublishedHttpPort
$WebServerInfo.PublishedHttpsPort = $item.PublishedHttpsPort
$WebServerInfo.PublishedExternalHttpPort = $item.PublishedExternalHttpPort
$WebServerInfo.PublishedExternalHttpsPort = $item.PublishedExternalHttpsPort
$WebServerInfo.ReachPrimaryPSOMServerPort = $item.ReachPrimaryPSOMServerPort
$WebServerInfo.ReachExternalPsomServerPort = $item.ReachExternalPsomServerPort
$WebServerInfo.AppSharingPortStart = $item.AppSharingPortStart
$WebServerInfo.AppSharingPortCount = $item.AppSharingPortCount
$WebServerInfo.LiServiceInternalUri = ObjToStr $item.LiServiceInternalUri
$WebServerInfo.ABHandlerInternalUri = ObjToStr $item.ABHandlerInternalUri
$WebServerInfo.ABHandlerExternalUri = ObjToStr $item.ABHandlerExternalUri
$WebServerInfo.DLExpansionInternalUri = ObjToStr $item.DLExpansionInternalUri
$WebServerInfo.DLExpansionExternalUri = ObjToStr $item.DLExpansionExternalUri
$WebServerInfo.CAHandlerInternalUri = ObjToStr $item.CAHandlerInternalUri
$WebServerInfo.CAHandlerExternalUri = ObjToStr $item.CAHandlerExternalUri
$WebServerInfo.CollabContentInternalUri = ObjToStr $item.CollabContentInternalUri
$WebServerInfo.CollabContentExternalUri = ObjToStr $item.CollabContentExternalUri
$WebServerInfo.CAHandlerInternalAnonUri = ObjToStr $item.CAHandlerInternalAnonUri
$WebServerInfo.DeviceUpdateDownloadInternalUri = ObjToStr $item.DeviceUpdateDownloadInternalUri
$WebServerInfo.deviceUpdateDownloadExternalUri = ObjToStr $item.deviceUpdateDownloadExternalUri
$WebServerInfo.DeviceUpdateStoreInternalUri = ObjToStr $item.DeviceUpdateStoreInternalUri
$WebServerInfo.DeviceUpdateStoreExternalUri = ObjToStr $item.DeviceUpdateStoreExternalUri
$WebServerInfo.RgsAgentServiceInternalUri = ObjToStr $item.RgsAgentServiceInternalUri
$WebServerInfo.RgsAgentServiceExternalUri = ObjToStr $item.RgsAgentServiceExternalUri
$WebServerInfo.MeetingExternalUri = ObjToStr $item.MeetingExternalUri
$WebServerInfo.DialinExternalUri = ObjToStr $item.DialinExternalUri
$WebServerInfo.CscpInternalUri = ObjToStr $item.CscpInternalUri
$WebServerInfo.ReachExternalUri = ObjToStr $item.ReachExternalUri
$WebServerInfo.ReachInternalUri = ObjToStr $item.ReachInternalUri
$WebServerInfo.WebTicketExternalUri = ObjToStr $item.WebTicketExternalUri
$WebServerInfo.WebTicketInternalUri = ObjToStr $item.WebTicketInternalUri
$WebServerInfo.ExternalFqdn = ObjToStr $item.ExternalFqdn
$WebServerInfo.InternalFqdn = ObjToStr $item.InternalFqdn
$WebServerInfo.Displayname = "Lync User Replicator -[" + $item.identity + "]"
$discovery.AddInstance( $WebServerInfo )
}
}

if ($global:advisorDiscoveredObjects -ne $null)
{
AddDiscoveryInstance $global:advisorDiscoveredObjects
}

$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>