2

On a windows 2003 Server, I have a Powershell 1.0 script that I can execute happily as myself due to setting the Execution Policy to remoteSigned in my own user.

Upgrading to current/newer technology is out of the question I'm afraid.

The script needs to actually be called from a Windows Service that is running under the LOCALSYSTEM account.

I suspect that the Execution Policy for this account is still restricting access to run the scripts.

Is there a way of setting the Execution Policy for the SYSTEM account to enable the scripts to run?

Perhaps a system wide setting??

thonnor
  • 1,206
  • 2
  • 14
  • 28
  • 1
    Can you do a `Get-ExecutionPolicy -list` and post the output as part of your question? – Swoogan Nov 14 '14 at 15:03
  • All working now. It was a PATH setting to Powershell.exe not being picked up by the LOCAL SYSTEM account. code rectified to include full path and everything works - Feeling very sheepish :) – thonnor Nov 14 '14 at 15:15

1 Answers1

1

Based on this answer: https://stackoverflow.com/a/4647585/140377 you can just run Set-ExecutionPolicy RemoteSigned as an administrator and it will apply to all users.

Community
  • 1
  • 1
Swoogan
  • 5,298
  • 5
  • 35
  • 47
  • It doesn't like the -Scope switch. It isn't supported at Powershell 1.0 – thonnor Nov 14 '14 at 15:02
  • If I told you all that the SYSTEM account doesn't look at the PATH in the environment variables and I'd overlooked this... would you all shout at me? I have now added the full path to Powershell.exe in the call and things are working. I've up-voted all answers at time of writing because even though they didn't solve it, they proved that I wasn't losing ALL of my marbles. – thonnor Nov 14 '14 at 15:13
  • 1
    @thonnor No worries. We've all been there. – Swoogan Nov 14 '14 at 15:32