<DataSourceModuleType ID="Microsoft.LS.2015.Discovery.UrlWatcher.DS" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="Microsoft.LS.2015.Discovery.Common.DS.ShellOut">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>Communication Server MP Url Watcher Discovery</ScriptName>
<ScriptFileName>UrlWatcherDiscovery.ps1</ScriptFileName>
<ScriptBody><Script>
#############################################################################
# Get list of Simple Url Configuration.
#############################################################################
#CONSTANTS###################################################################
$GLOBAL_SCOPE = "Global"
$URL_DISPLAYNAME_FORMAT = "Url: [{0}]"
$MEET_URL_FORMAT = "{0}/TestAlias/TestCode1234"
$MEET_SVC_URL_FORMAT = "{0}/TestDomainAlias/TestAlias/TestCode1234"
$DIALIN_URL_FORMAT = "{0}"
$WEBSCHEDULER_URL_FORMAT = "{0}/Scheduler"
$CSCP_URL_FORMAT = "{0}/cscp"
# TODO - FYFIX: CSCP type is not supported. It requires authentication.
# TODO - FYFIX: web scheduler. Requires Auth. cannot find any part of that doesn't require auth.
# Testing fix: Set evaluation of base page rendering to GreaterThan 403. This means by HTTP RFC that even if it fails to login, but the server responds
# with something, it will pass.
$TEST_URL_FORMATS = @{
"meet" = $MEET_URL_FORMAT;
"dialin" = $DIALIN_URL_FORMAT;
"meet_svc" = $MEET_SVC_URL_FORMAT;
"webscheduler" = $WEBSCHEDULER_URL_FORMAT;
"cscp" = $CSCP_URL_FORMAT;
};
# E.g: https://lslm84.meet.microsoft.com/meet/anandl/5KITIMIM or
# in service: https://meet.skype.com/contoso/joe/123456
#############################################################################
$CSONLINE_MODULE_NAME = "SkypeForBusinessOnline"
$CSONLINE_MODULE_ADDED = "SkypeForBusinessOnline Module is added";
$CSONLINE_MODULE_ALREADY_LOADED = "SkypeForBusinessOnline Module is already loaded. No need to reload."
$CSONLINE_MODULE_FAILED_LOAD = "Failed to load SkypeForBusinessOnline Module. Error: {0}."
$CS_MODULE_NAME = "SkypeForBusiness"
$CS_MODULE_ADDED = "SkypeForBusiness Module is added";
$CS_MODULE_ALREADY_LOADED = "SkypeForBusiness Module is already loaded. No need to reload."
$CS_MODULE_FAILED_LOAD = "Failed to load SkypeForBusiness Module. Error: {0}."
$NO_PROV_SERVICE_CONFIG = "No provisioning configuration found, please check your configuration !"
$NO_SIMPLEURLDNS_CONFIG = "No SimpleURLDNS configuration found for provisioning service, please check your configuration !"
function LoadCSModule()
{
# Script execution are managed by SCOM powershell module.
# MonitoringHost.exe is hosting powershell runspaces.
# SCOM might run the scripts on the same process and reuse the app domain if neccesary.
# Double check on wheter module is loaded or not.
if (IsCSModuleLoaded)
{
TRACE ($CS_MODULE_ALREADY_LOADED)
}
else
{
# Refresh PSModulePath in case new build is deployed into different folder but SCOM Agent is not restarted
$psPaths = $env:PSModulePath -split ";"
$env:PSModulePath = ($psPaths + ([Environment]::GetEnvironmentVariable("PSModulePath", "Machine") -split ";" | ?{$psPaths -notcontains $_})) -join ";"
# Due to possible race condition between steps of checking module is loaded and loading module steps,
# we need to double check after module loading attempt.
$moduleImported = $false
$retryCount = 0
# TODO - FY: Merge LoadCSModule and LoadCSOnlineModule functions.
function IsCSOnlineModuleLoaded()
{
(get-module $CSONLINE_MODULE_NAME ) -ne $null
}
function LoadCSOnlineModule()
{
# Script execution are managed by SCOM powershell module.
# MonitoringHost.exe is hosting powershell runspaces.
# SCOM might run the scripts on the same process and reuse the app domain if neccesary.
# Double check on wheter module is loaded or not.
if (IsCSOnlineModuleLoaded)
{
TRACE ($CSONLINE_MODULE_ALREADY_LOADED)
}
else
{
# Refresh PSModulePath in case new build is deployed into different folder but SCOM Agent is not restarted
$psPaths = $env:PSModulePath -split ";"
$env:PSModulePath = ($psPaths + ([Environment]::GetEnvironmentVariable("PSModulePath", "Machine") -split ";" | ?{$psPaths -notcontains $_})) -join ";"
# Due to possible race condition between steps of checking module is loaded and loading module steps,
# we need to double check after module loading attempt.
$moduleImported = $false
$retryCount = 0
function IsProvisionServiceInstalled()
{
TRACE ("Searching for provision service in the topology.")
$provisionServiceName = [Microsoft.Rtc.Management.Core.RoleName]::ProvisionService
$prov = ((get-cstopology).Services | where {$_.RoleId.Name -eq $provisionServiceName})
$result = $prov -ne $null
if ($result)
{
TRACE ("Successfully found provision service in the topology.")
}
else
{
TRACE ("Can not find provision service in the topology.")
}
$result
}
# Logic: Look for provisioning Server in the topology. This should be present only in the service deployments.
# Based on the results, you can choose which URLs to ping (server or service)
If (IsProvisionServiceInstalled)
{
# We expect the provisioning service to be present only in the service deployments.
LoadCSOnlineModule
If (IsCSOnlineModuleLoaded)
{
$provConfig = Get-CsProvisionServiceConfiguration
if ($provConfig -ne $null)
{
$simpleurl = $provConfig.SimpleUrlDNSName
if ($simpleurl -ne $null)
{
$domain = "*"
#this is hardcoded because it _ONLY_ applies in the online "provisioning" condition
$IsActive = $true
$component = "meet_svc"
}
}
# If there is not provisioning service, assume it's onprem only and get URL's via onprem method, or just tag the simpleURLs onto the existing online URLs.
## TODO - FYFIX: Currently only iterating over Global Simple Urls.
# There is always default value for Global identity.