Can I create a PowerShell embedded script?

Article ID: 324
Category: Application Scheduler
Applies to: EventSentry 3.0 or newer
Updated: 2017-02-14

Yes!

Navigate to Tools > Embedded scripts within the EventSentry management console. The "Manage Embedded Scripts" window then open and from there you can click "New" to create a new .ps1 script. In this example, I'll name my script get_logs.ps1 and the script will be:

Get-Childitem C:\Windows\SYSTEM32\EventSentry\logs*.log

Also, you'll want to make sure you select the appropriate interpreter so that this script can run; in the interpreter dropdown, make sure to choose:

powershell.exe -inputformat none -file

If you haven't already done so, set the proper PowerShell execution policy on the system where the script will be executed, since running PowerShell scripts is disabled by default. 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

Your PowerShell script is now ready to be used in the Application Scheduler or Process action within EventSentry.