ConnRefreshScript (Resource)

Element properties:

TypeResource
File NameDSConnections.ps1
AccessibilityInternal

Source Code:

<Resource ID="ConnRefreshScript" FileName="DSConnections.ps1" Accessibility="Internal"/>

File Content: DSConnections.ps1

Param($selectedServer)


#
#Powershell Script for obtaining all connections from the servers - Main Dashboard
#

# Start clean
$ScriptContext.ReturnCollection.Clear()

# We will need a param from the Diagnostic Server grid to pass in here
$ServerName = $selectedServer #get the server name passed from top DS grid
[bool] $DisplayAgentAlarmsOnly = 0 #0=False,other than 0 = True... Param(2) #pass in whether we want to display agent alarms only

if ($ServerName -ne $NULL -and $ServerName -ne "")
{
#Instantiate a dsConnections class and get all the instances related to it
$dsConnClass = Get-SCOMClass -Name Quest.SoSSE.Connections
$dsConnClassInstances = Get-SCOMClassInstance -Class $dsConnClass

foreach ($dsConnClassInstance in $dsConnClassInstances)
{
if ($dsConnClassInstance.'[Quest.SoSSE.Connections].DSName'.value -like $ServerName)
{
# if ($dsConnClassInstance.'[Quest.SoSSE.Connections].TechnologyType'.value -ne "Diagnostic Server")
# {
$dataObject = $ScriptContext.CreateFromObject($dsConnClassInstance, "Id=Id,DisplayName=DisplayName,InMaintenanceMode=InMaintenanceMode", $null)

$dataObject["Id"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].Id'.value
$dataObject["SortId"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SortId'.value
$dataObject["ConnectionName"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].ConnectionName'.value
$dataObject["ConnectionDisplayName"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].ConnectionDisplayName'.value
$dataObject["TechnologyType"] =$dsConnClassInstance.'[Quest.SoSSE.Connections].TechnologyType'.value
$dataObject["InOutage"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].InOutage'.value
$dataObject["Enabled"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].Enabled'.value
$dataObject["SevHighCount"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SevHighCount'.value
$dataObject["SevMediumCount"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SevMediumCount'.value
$dataObject["SevLowCount"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SevLowCount'.value
$dataObject["SevInformationCount"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SevInformationCount'.value
$dataObject["SevDisabledCount"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].SevDisabledCount'.value
$dataObject["DSName"] = $dsConnClassInstance.'[Quest.SoSSE.Connections].DSName'.value
$ScriptContext.ReturnCollection.Add($dataObject)
# }
}
}
}