PowerShell
Edit|Remove
Param($globalSelectedItems) 
 
foreach ($globalSelectedItem in $globalSelectedItems) 
{ 
  $globalSelectedItemInstance = Get-SCOMClassInstance -Id $globalSelectedItem["Id"] 
   foreach ($relatedItem in $globalSelectedItemInstance.GetRelatedMonitoringObjects()) 
  { 
    $dataObject = $ScriptContext.CreateFromObject($relatedItem"Id=Id,State=HealthState,DisplayName=DisplayName"$null) 
    $dataObject["ParentRelatedObject"] = $globalSelectedItemInstance.DisplayName 
    $ScriptContext.ReturnCollection.Add($dataObject) 
  } 
}
 

 

This sample introduces the variable $globalSelectedItems.

When creating dashboards you can pass context between widgets using the variable $globalSelectedItems. The sample script above will take a selected instance from another widget on the dashboard and return the child objects and their relevant state.

To use add a Powershell Grid Widget(PSG) to a dashboard that already contains a widget that has instances that can be selected and copy the above script into the widget configuration.