Technical Resources

Powershell Monitoring: Best Methods

Best Methods for Running PowerShell Scripts Using FrameFlow

FrameFlow lets you develop custom monitoring features using PowerShell and integrate them with its monitoring and alerting engine. This article provides tips on using PowerShell scripts with FrameFlow.

Verify PowerShell is Installed

Before proceeding it's usually a good idea to verify that PowerShell is installed on the system where FrameFlow is running. PowerShell is available by default on Windows Server 2008 and later but we've seen cases where it had been removed or disabled.

You can verify that PowerShell is available by opening a command line window and typing "powershell". An error message will be displayed if PowerShell is not installed. You can type "exit" to return to the default Windows command line prompt.

PowerShell Error Messages

If you see the following error message when running your PowerShell event monitor, there are several possible causes which are discussed here:

The 'Success=' and 'Failure=' line was not found in the PowerShell output.

The lines following this message will provide details on the cause of the problem. If the following text appears this indicates that PowerShell is not installed on the system. You will need to download it from the Microsoft website or install it using the Server Manager.

'powershell' is not recognized as an internal or external command, operable program, or batch file.

If any other output appears at the end of the message then it likely means that there's a coding error in your script. It's usually easiest to test your scripts from the command line before pasting the code into FrameFlow's PowerShell event monitor.

Permissions

By default, FrameFlow runs in the LocalSystem account. That's the best account for scripting actions that will run on the system where FrameFlow is running. If your script needs to access other systems on the network then it may fail with "access denied" or other issues related to permissions. To solve this, use the Windows service manager in the Administrative Tools section of the Control Panel to set the FrameFlow Service to run in another account that has permissions.

Note that all scripts run by the PowerShell event monitor are run on the system where FrameFlow is running. If your script needs to access other systems then it will need to include the necessary code for those operations.

Truncated Text

In some cases, you may notice that the text you output in your PowerShell script. If this is the case, ensure that your script uses the Write-Host command for all output as shown in the following example.

# This text will not be truncated when it appears in the FrameFlow event history
Write-Host "Success(devicename)=Very long output text showing the results of the monitoring action..."

Wrap Up

FrameFlow's support for PowerShell monitoring provides a very powerful method for developing monitoring tasks that are custom to your environment. They integrate perfectly with FrameFlow's monitoring, alerting, dashboarding, and reporting features.

If you need help getting your PowerShell scripts to work with FrameFlow, just let us know. We're always happy to help out in any way we can.

Back