How to Run a Powershell Script as a Continuity Engine User-defined Task

How to Run a Powershell Script as a Continuity Engine User-defined Task

Summary

This Knowledge base article provides general information about how to run a powershell script launched by a user-defined task defined in Neverfail Continuity Engine.

Procedure

A powershell script may be run from within a Continuity Engine task by editing the command similar as being invoked from the command line, e.g.

CMD> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "C:\test.ps1"

Prerequisites

Powershell execution policy should be set appropriate to allow script execution in your environment (in this example is set to RemoteSigned)

Check/set policy using:
  1. Get-ExecutionPolicy
  2. Set-ExecutionPolicy
Possible values:
  1. Restricted — No scripts are allowed. This is the default setting, so you will see it the first time you run the command.
  2. AllSigned — You can run scripts signed by a trusted developer. With this setting in place, before executing, a script will ask you to confirm that you want to run it.
  3. RemoteSigned — You can run your own scripts or scripts signed by a trusted developer.
  4. Unrestricted — You can run any script you want.

Steps

  1. Create a simple hello world powershell script - test.ps1
    1. Write-Host "Hello, World!"
  2. Create a Continuity Engine user defined task as described in How to Create a Task In Neverfail Continuity Engine
    1. Edit the following command - make sure you edit the correct path to powershell.exe as well as full path to the script
      1. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "C:\test.ps1"
  3. Test execution: Run Engine task (Manual or creating triggering conditions)
    1. Event Log should record script's execution

Applies to

Neverfail Continuity Engine - all versions
    • Related Articles

    • How to Create a Task In Neverfail Continuity Engine

      Summary This Knowledge base article provides general information about how to create Tasks in Neverfail Continuity Engine. More Information Tasks are a generalization and extension of start, stop, and monitor scripts. Task types are grouped by when ...
    • How to Configure Rules in Neverfail Continuity Engine

      Summary This Knowledgebase article provides information about configuring rules in Neverfail Continuity Engine. More Information  Rules Overview Rules are implemented by plug-ins (there are no user-defined rules). Rules can be either timed (they must ...
    • Reference: Continuity Engine Product Architecture

      Summary This Quick Reference provides an overview of the key concepts and components of Neverfail Continuity Engine product architecture: More Information Key Concepts and Components Component / Concept Description Active-Passive Server Pair ...
    • Continuity Engine Product Architecture

      Learning objectives At the completion of this session, you should be able to: Identify major components of the Neverfail Continuity Engine product architecture. Describe major component configuration. Identify advantages of the Neverfail Continuity ...
    • How to Configure Application Services In Neverfail Continuity Engine

      Summary This Knowledgebase article provides information about how to configure application services in Neverfail Continuity Engine.  More Information  Services page The Engine Management Service Services page shows services specified by plug-ins or ...