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 ?


I'm guessing that the prompt you're seeing looks like this:

Security Warning Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your computer. Do you want to run \server\scripts\my.ps1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): d

If you run "get-help about_execution_policies", you'll see the behavior for 'Unrestricted' defined as:

 - Unsigned scripts can run. (This risks running malicious

 - Warns the user before running scripts and configuration
   files that are downloaded from the Internet.

Even when set to Unrestricted, PowerShell will prompt you to run scripts that it thinks were downloaded from the internet -- this can include scripts being called from UNC paths. You can adjust the behavior by tweaking the Internet Explorer security zones on the computer (yes, really), and/or by configuring .NET code access security policies on the system using caspol.exe.

Here are some helpful links if this is in fact the prompt you're seeing:




| improve this answer | |
  • Thnaks. That is precisely the message I'm getting. Why do you think it applies to some users and not others ? – Stephane Aug 2 '13 at 16:00
  • I would guess their IE zone settings are different. – jbsmith Aug 2 '13 at 16:10
  • also Set-ExecutionPolicy bypass can sovle this problem – strange walker Feb 25 '14 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.