I have an application in a Citrix/2008R2 that is acting as a user starting point for other apps.
I have recently had to modify this application to integrate it more deeply with active directory. As part of this process the application sometimes has to run the user login script directly (instead of counting on the login process to do so).
That script is written in powershell and, among other things, maps the users drives based on what OU the account object is in. I had to modify the script to take into account users who had to chose their work environment when they log in and therefore cannot use the standard login script.
Anyway: my issue is that, when the script is started from a DFS UNC path from my application, it fails to run, asking the user to confirm its execution. I checked the execution policies in both 32 and 64 bits powershell and they are like this:
Scope ExecutionPolicy ----- --------------- MachinePolicy Unrestricted UserPolicy Unrestricted Process Undefined CurrentUser Undefined LocalMachine Unrestricted I have made sure that the group policy applied to both the user and the computer should allow all script to run: 
For now, I have resorted to making a copy of the script to the temp folder and running it from there (it works fine) but it is nagging me: I can't see any logical reason why powershell would refuse the execution of that script.
Anyone has an idea what is happening here ?
edit
To clarify, I am experiencing the common powershell security warning here:
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 \\xxxx\xxxx\xxxx\test_powershell.ps1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):