What can cause Powershell execution policy not to be taken into account?

Posted by Stephane on Server Fault See other posts from Server Fault or by Stephane
Published on 2013-08-02T13:21:35Z Indexed on 2013/08/02 15:41 UTC
Read the original article Hit count: 301

Filed under:

We have in our infrastructure a number of powershell scripts used for various tasks ranging from user login to support technician simulating a user context.

These scripts are centralized on our file server (through DFS) for easier management. Some of them are run at logon, some are run through published Citrix applications.

We have applied a policy for the whole domain and all users that sets the Powershell execution policy to "unrestricted" so that the scripts can run from the file server.

This works perfectly fine for logon script (at least, so far) but for scripts that are run later (usually through a published application but the same applies when using terminal services and a full desktop), the results are inconsistent: some users can run the script fine, some are always prompted in the powershell console for letting the scripts run.

I cannot find anything that could cause this behavior and it's really inconsistent: if I start powershell manually and runs get-executionpolicy, I am told that the current policy is unrestricted. Yet, if from the same session I try to run a script through a program that calls powershell <script file name> <parameters> I get prompted before the script can run.

What could cause such behavior ?

© Server Fault or respective owner

Related posts about powershell