Thursday, July 3, 2014

PowerShell Grid Widget Troubleshooting

A quick way to troubleshoot problems in the new PowerShell Grid Widgets and show the error directly in the dashboard:


Just implement the following lines into your existing widget script:

foreach ($object in $objects) {
$dataObject = $ScriptContext.CreateInstance("xsd://foo!bar/baz")
  $dataObject["Id"] = [String]($object.Id)
  $dataObject["..."] = [String](...)
  if ($error) {
    $dataObject["Error"] = [String]($error)


The $error.clear() cleans up the $error variable so that every line in your dashboard only shows the related errors.

The error column will disappear once no error has occurred and you switched to another view and back.

All information is provided "as is" without any warranty! Try in lab before. Handle with care in production.


  1. Hello Patrick,
    Thank you for sharing the articles!
    I try to configure SCOM to get the result of the Get-CusterGroup in a Powershell Grid widget but I don’t understand how to configure the import-module function, I try to explain:
    The command returns the list of roles of the cluster, the ownernode (to know where is running the single role), and the status (Online or Offline).
    The script works, but only if the dashboard is viewed by PCs that have installed the Windows feature that add the Windows FailOver Clustering Tools. If I try to view the dashbord from a PC that don’t have this features installed, the window of scom appears empty.
    How can I import the module for integrate it into my script in SCOM? I need this to display the dashboard without that I have to install the windows feature.

  2. Hi Antonio,
    you'll need the feature with the PowerShell module installed on every computer running the console that is supposed to show the dashboard.
    As long as the user has admin rights, you could install the feature in the PS Grid Widget using:
    Install-WindowsFeature -Name Failover-Clustering –IncludeManagementTools

    Maybe first check of it exists already using:
    Get-WindowsFeature Failover-Clustering

    HTH, Patrick

  3. Thank you Patrick,
    I think that might be a command server and it cannot work for me.


  4. Well, in that case the admins of that machine(s) could install the feature in advance.

  5. Ok, thank you for your support.