On Windows, there is usually tighter control of PowerShell scripts (.ps1) than batch files or executables. For example, the default behavior of double-clicking a batch file (.bat) will execute the script, but double-clicking PowerShell files (.ps1) will open Notepad for editing. In order to use PowerShell commands or scripts, the powershell.exe executable should be explicitly called. There are also command parameters like execution policy that may need to be specified.
To help users get started, we have created an one line example below which displays the current system time.
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -Sta 'row,value'; $now=Get-Date; 'time,'+ $now.ToShortTimeString();
The command returns the system time together with the necessary headers in a CSV based format. This is required for parsing by the Toolkit plug-in.
The PowerShell command is defined in the Toolkit sampler's "Sampler script" field as seen below:
The command output will be displayed in the form of a dataview in the Active Console like this.
Further Reading
Geneos users can refer to the Toolkit Plug-In User Guide
Comments
0 comments
Please sign in to leave a comment.