I have tested a script stand-alone both as and not as the Administrator and it works just fine. So I added this script to a build event as part of a VisualStudio project. When it runs there I get the error:
xxxx\Merge.ps1 cannot be loadedbecause running scripts is disabled on this system. For more information, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ xxxx\Merge.ps1
xxx\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
First the first message is wrong:
PS xxxx> Get-ExecutionPolicyRemoteSigned
I am running this script as PowerShell xxxx\Merge.ps1 in VS. Where 'xxxx' is the folder where the script is located.
Ideas about why I am getting this security error? Ways to overcome it?
Kevin Burton