How to run PowerShell scripts either through the application scheduler or actions

Article ID: 397
Category: Scripts
Applies to: 3.5 and later
Updated: 2019-09-04

In order to launch PowerShell scripts from EventSentry you will need to verify/change the execution policy and supply the -inputformat none parameter to powershell.exe. For example:

powershell -inputformat none "c:\scripts\eventsentry\dothis.ps1"

When logging to the console from your PowerShell script, make sure that you use the Write-Output, and not the Write-Host method.

Since running unsigned PowerShell scripts is disabled by default, set the proper PowerShell execution policy on the system where the script will be executed. The execution policy needs to be either set to "RemoteSigned" (recommended) or "Unrestricted". To set the execution policy, open an elevated PowerShell command prompt and run:

Set-ExecutionPolicy RemoteSigned