Documentation forServer & Application Monitor

Create a Windows PowerShell script monitor in SAM

As described in PowerShell scripting in SAM component monitors, you can use the predefined Windows PowerShell Monitor included in SAM to create custom scripts for templates, and then assign templates to the main Orion server or remote target nodes. After running a script, SAM processes the script's exit code and text output to display results in the Orion Web Console.

To create a script with the Windows PowerShell Monitor:

  1. Click Settings > All Settings > SAM Settings> Manage Templates.

    The Manage Application Monitor Templates page displays all available out-of-the-box and custom templates.

  2. Search to locate, select, and edit an existing template or click Create New Template.

  3. Click Add Component Monitor(s) and choose Manually Add Component Monitors.
  4. Enter PowerShell as search text, select the Windows PowerShell Monitor, and then click add.

  5. Enter all arguments and parameters for the Script Arguments.

    If using Remote Host as the Execution Mode, the Port Number should correlate with the TCP port used by the listener on the remote, target server. The default port for WinRM is 5986.

  6. Click Edit Script to enter and test the script.

    Sample scripts are provided in the following default folder on the Orion server: C:\Program Files (x86)\SolarWinds\Orion\APM\SampleScriptMonitors

  7. Test the script by selecting settings for the output, specified node, and specified credentials. Click Get Script Output.

    Output results display using the script code with success or failure and any additional notes.

  8. Click Get Script Output to generate the output and click Save.

    The metrics save to outputs to configure as part of the component monitor. These outputs display at polling intervals for the template.

  9. When complete, click Submit to save the template.
  10. Create an application monitor based on the new template and assign it to a target node. See

When tested, output generates into customizable sections. Each output section is named by the Unique ID with a Display Name you can edit. For each output, you can optionally:

  • Convert the value using selected formulas.
  • Configure statistic thresholds to refine alerting for the component monitor. Set the warning and critical thresholds with specific values or baseline data.
  • Select a roll-up status sort option to display the best or worst status up through the template and component monitor.
  • Add notes to describe the script output.

If a PowerShell script monitor causes an exception that references "SetBufferContents", see this Success Center article.