1

Solution: Ended having to enable "Turn on Script Execution" in Group Policy. Located under Administrative Templates\Windows Components\Windows Powershell. Enable policy and set your desired execution policy.

Server 2008 R2

Utilizing file screen alerts and trying to execute a powershell script but cannot get it working for some reason.

I've been trying basic 1 line scripts ( log off a session ID) and it's not working. The alerts go through, but the script is not executed.

Here's the settings:

Settings

I've tried working directory in SysWoW, C:\, System32 nothing works and everything I read says it should.

Can anyone point out what I'm doing wrong?

10
  • Is powershell not executing or is your script not processing what it should? What's the execution level set on this machine? What's the code of the actual script? Commented Dec 18, 2015 at 15:40
  • Are you receiving an error which you can post? Commented Dec 18, 2015 at 16:27
  • @Colyn1337 powershell is not executing. Execution level is set as unrestricted on this machine and run as System privileges. I've tried a simple 'stop-machine' or 'logoff 2' (where session ID 2 is logged in and uneffected) Commented Dec 19, 2015 at 2:11
  • @bentek no errors, unfortunately. Nothing in event logs either, just the event for the file screen alert which does fire off, I receive the email alert but no script execution. Batch works fine though Commented Dec 19, 2015 at 2:15
  • How do you have it set to trigger? Commented Dec 19, 2015 at 2:16

2 Answers 2

0

Solution: Ended having to enable "Turn on Script Execution" in Group Policy. Located under Administrative Templates\Windows Components\Windows Powershell. Enable policy and set your desired execution policy.

0

This method worked for me

For a bit of background I wanted to creating a syslog message to be sent to a server when a quote got reached. I tested the script directly in powershell and worked.

  • Put the PS script file in the root folder where the Powershell EXE is. In my case the PS file is called syslogscript.ps1
  • In the Run a command or script field put %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe I am running server 2012 so may be different depending on your Windows build
  • In the command argument field powershell -executionpolicy bypass -File .\syslogscript.ps1
  • When I reached my quote the script executed
1
  • If you're bypassing the execution policy, that is the equivalent of enabling script execution. Commented Mar 16, 2022 at 21:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.