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:
- Get-ExecutionPolicy
- Set-ExecutionPolicy
Possible values:
- Restricted — No scripts are allowed. This is the default setting, so you will see it the first time you run the command.
- 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.
- RemoteSigned — You can run your own scripts or scripts signed by a trusted developer.
- Unrestricted — You can run any script you want.
Steps
- Create a simple hello world powershell script - test.ps1
- Write-Host "Hello, World!"
Edit the following command - make sure you edit the correct path to powershell.exe as well as full path to the script
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "C:\test.ps1"
Test execution: Run Engine task (Manual or creating triggering conditions)
- 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 ...