Submit a ticketCall us

whitepaperYour VM Perplexities Called, and They Need You to Read This.

Virtualization can give you enormous flexibility with future workloads and can be a key enabler for other areas, like cloud computing and disaster recovery. So, how can you get a handle on the performance challenges in your virtual environment and manage deployments without erasing the potential upside? Learn the four key areas you need to be focusing on to help deliver a healthy and well-performing data center.

Get your free white paper.

Home > Success Center > Server & Application Monitor (SAM) > SAM Documentation > SAM Custom Template Guide > Windows scripting in SAM custom templates

Windows scripting in SAM custom templates

The SAM Windows Script monitor supports custom scripts on Windows-based systems. You can create multiple instances of this component monitor per template to run custom scripts.

This information details the format and usage of Windows Scripts for SAM, including script arguments and output formats. This information does not provide information on coding in programming languages such as those listed in the Script Engine field.

After configuring Windows and reviewing the components of a script, create Windows scripts using the component monitor per template.

Windows Script support in SAM

SAM supports using Windows scripting on target Windows-based computers.

To locate a list of out-of-the-box Windows Script supporting templates, navigate to the Manage Templates page. Click Settings > All Settings > SAM Settings and click Manage Templates. In the search field, enter Windows to filter the list. These templates use customized instances of the Windows Script Monitor.

Use different scripting languages

On Windows-based computers, you can use one of several scripting languages or install a non-native scripting language.

  1. Install the scripting language engine or software on the Orion server.
  2. When installed, verify the install location for the scripting language is in the system environment path variable.
  3. In the SAM template Windows script monitor, enter the scripting language in the Script Engine.

How the Windows script works

The Windows Script Monitor executes the script on the Orion server connecting to the target server to collect metrics:

  1. Executes the script using the script arguments on the Orion server.

  2. The monitor connects to the target server using entered credentials for collecting metrics.
  3. SAM parses the text output, saves data, and reports the values using the output formats from the component monitor.

Components of a Windows Script

SolarWinds recommends writing scripts in the Windows Script monitor to verify correct access between the main polling engine, SAM, and the target server(s). You can write and test scripts in your preferred ISE, connecting and testing against the target server to verify if the code functions. You must test the script through the Windows Script monitor to ensure entered credentials and target server access, and to generate metrics output.

The script in the monitor should include:

  • Parameters to run the script in the Scripts Arguments field
  • Script code added in the Script Body field with credentials
  • The script engine to use for the supported programming language
  • Exit codes to report status in the script
  • Formatted output after running the script

You must test the component monitor and script before assigning and using the component monitor within a template as is. Testing the script generates the required database tables for metrics output and verifies output processes.

Script Fields

Script Arguments field

This field is in the script editing window and allows you to specify arguments to pass to the script. You may include the variables ${IP} (or ${Node.DNS}), ${USER}, and ${PASSWORD}, which are replaced respectively by the IP address of the target node, the credential user name, and the credential password.

Script Body field

Use the Script Body field to enter your script code. You can write and compile the script in a language you prefer then copy and paste the code into this field. For example, customers have used Python. Depending on the language, you may need to take additional steps for the script and command line to execute.

Scripts must report their status by exiting with the appropriate exit code. The exit code is used to report the status of the monitor, displayed in the Orion Web Console.

Script Engine

This field allows you to specify the scripting language to be used. The default value is vbscript. Below is a list of scripting engines that the Windows Script Host supports:

Name File Extensions Availability



Installed by default



Installed by default



















Object Rexx engine



Delphi scripting engine



VBscript runs locally on the SAM server only. PowerShell uses WINRM that runs over TCP ports 5985 and 5986. All Linux, Unix, and Nagios script monitors use SSH over TCP Port 22. 

Last modified