SolarWinds uses cookies on our websites to facilitate and improve your online experience. By continuing to use our website, you consent to our use of cookies. For further details on cookies, please see our cookies policy.

Attend our instructor-led classes, provided by SolarWinds® Academy, to discuss the more advanced monitoring mechanisms available in NPM as well as how to tune your equipment to optimize its polling capabilities. NPM classes offered:NPM Custom Monitoring and PollingOrion Platform Scalability

Problems using the Windows PowerShell Monitor in SAM

Table of contents

Overview

This article describes troubleshooting steps in resolving common problems using the Windows PowerShell Monitor, such as the following:

Could not loadtype 'System.Management.Automation.Runspaces.WSManConnectionInfo' from assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e37'

The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests...

The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting.

The field Execution Mode specifies wherethe PowerShell script specified in the monitor can be executed.
​The available options are:

Local Host - selecting this option means that the PowerShell script can only be executed locally on the Orion server.

Remote Host - selecting this option means that the PowerShell script can be executed remotely (on the selected target node) using the Windows Remote Management (WRM) system component. WRM should be configured separately to get it working with the Windows PowerShell Monitor. If Remote Host is selected, the following options are available:

Use HTTPS Protocol — if checked, specifies that the secure HTTPS protocol should be used to send and receive WS-Management protocol requests and responses. Otherwise the HTTP protocol is used.

URL Prefix — specifies a URL prefix on which to accept HTTP or HTTPS requests. The default is wsman.

Port Number — specifies the TCP port for which this listener is created. For WinRM 1.1 and earlier, the default HTTP port is 80. For WinRM 2.0, the default HTTP port is 5985.

If you are using Version 2 for PowerShell Version in order to execute the PowerShell script remotely, note that the Windows Remote Management (WRM) system component is used for performing the remote execution. If the Windows Remote Management (WRM) system component is not properly configured, the script execution will fail.​

Possible Errors and their resolutions:

1. Issue: Could not loadtype 'System.Management.Automation.Runspaces.WSManConnectionInfo' from assembly 'System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e37' Cause: The machine where the Orion server is running has not installed the Windows Remote Management (WRM) system component and Windows PowerShell 2.0.

2. Issue: Connecting to remote server failed with the following error message: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRMservice: winrm quickconfig. For more information, see the about_Remote_Troubleshooting Help topic.

Description: WinRM is not configured on the machine.

Resolution: On the command line, enter winrm quickconfigand select yes in the dialog for quick configuration.

3. Issue: Connecting to remote server failed with the following error message: The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Usewinrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.

Description: Connection could not be established because host (that is, the Orion server) is not trusted.

Requirements for PowerShell scripts to work correctly with the Windows PowerShell Script Monitor:

In your PowerShell script, define the string Statistic: XX where XX is the output value of the script. This is a numeric value used to determine how the monitor compares to its set thresholds. The monitor is parsing statistics from the output, and if this string does not exist, the script fails.

Your PowerShell script must report an exit code that represents its outcome. For example, if you place the command exit(0) at the end of your PowerShell script, that exits the script and returns an error code of 0, which means the component monitor is up. For details about exit codes and their meanings, see Creating a Windows Script monitor.