With V8.7, we introduced a PowerShell widget to our Summary Dashboards in the Live Maps Portal. With this widget we open up the possibilities you have to display data. Now your source of data can be from just about anything. Please keep in mind that it is made to display data in a dashboard. 

To start off with, you must understand that all PowerShell is run under the App Pool user. This generally doesn't have a problem when you are talking about gathering information from SCOM or from the local server, however could represent an issue when trying to gather information from remote servers. Just be aware of this potential issue. 

Once you click on the Powershell icon during the edit mode you will be presented with a dialog box below. 

1. Title - All widgets require a title and this one is no exception. 

2. Time Limit(seconds) - Next you need to give it a time out. How long do you want it to wait to verify the returns of the PowerShell script. 

3. Time Limit State - This is the state you would like to display if the script takes to long. 

4. Display Type. - How would you like for it to be displayed. By default it  is set to Single Value. That is any String Value. It can can be a single value or multiple lines. Grid View is a lot like a Table. It is only valid if you are returning one or more objects and want them displayed in a "Format Table" Type of View. Last is the Target Gauge. It is a single bar graph with the value, a target and a max. Most of the time, the results you need will be in Single Value. NOTE: There are times that you might need to play with this setting depending on what you want to show. If all else fails set it to Single Value and make sure you Script contains the "| Out-String" Command 


Grid View

Single Value

Target Gauge

5. Script. This is the script itself. 

Script Help

While we try to allow you to have a native PowerShell experience, Not all functions will work. That being said, here are some items that will help you out. 

Write-Host is currently not supported, but you can simply write a line in quotes. 


"Hello World"    


“New Critical Alerts = " + (get-scomalert -criteria ‘ResolutionState = ”0” AND Severity = ”2”’).count

String Out your Script

Out-String - may need to be used in several cases to return a result. Example.

Get-SCOMGroup -DisplayName “Training List Dashboard” | Get-SCOMClassInstance | Out-String

Error Indication

If for some reason there is an error with the PowerShell Script, then the title bar will be shown in RED and the error message will be displayed. 

This can actually be useful to help change the display based on conditions. Take the following example script. Script is set to give you a count of Critical Alerts. Under normal Conditions it would just display the total alerts in a big number.

$alertCount = (get-scomalert -criteria ‘ResolutionState = ”0” AND Severity = ”2”’).count
If ($alertCount -lt 25) {
    Else {
    Write-Error "Too Many Critical Alerts"

 But when the conditions exceed the total number of alerts, then it would change. 

Location of Portal

The location of where the Portal installation is a key on requirements for the script. If for example the Portal is installed on a SCOM mgmt server, then generally you can simply have one line scripts. Example. 


However if you have the Portal installed on a non-SCOM mgmt server, then you should add a couple lines at the beginning of the script to ensure it will work. Example. 

Import-Module OperationsManager
New-SCOMManagementGroupConnection -ComputerName <server name of mgmt server>