This topic contains 5 replies, has 3 voices, and was last updated by
November 6, 2013 at 12:42 pm #11218
I'm trying to run a script written by someone else off of a network share. I'm executing it from a command line with the syntax powershell -executionpolicy bypass -file \\server\share\script.ps1. I get an error that the file is not digitally signed.
I'm confused as to why isn't it bypassing the executionpolicy?
November 6, 2013 at 12:48 pm #11220MemberPoints: 0Rank: Member
Run this command at a PowerShell console, and post the results:
It's possible that execution policy is being assigned to you via Group Policy; if that's the case, you can't override it with the -ExecutionPolicy parameter. This is from the about_Execution_Policies help file:
EXECUTION POLICY PRECEDENCE
When determining the effective execution policy for a
session, Windows PowerShell evaluates the execution policies
in the following precedence order:
– Group Policy: Computer Configuration
– Group Policy: User Configuration
– Execution Policy: Process (or PowerShell.exe -ExecutionPolicy)
– Execution Policy: CurrentUser
– Execution Policy: LocalMachine
November 6, 2013 at 12:55 pm #11223
November 6, 2013 at 1:47 pm #11226
It gets stranger. I wrote a 1 liner 'Hello Word' script and saved it to my personal network share, and tried to run it on the same computer, using bypass -file; worked like a hero.
I copied the exact same script to the network share of the script that won't run, and now the same script gives me the error that my script is not signed. Hurr?
November 6, 2013 at 2:49 pm #11229MemberPoints: 0Rank: Member
Yep, you've got RemoteSigned coming from Group Policy. Unless you'll be allowed to change that, you'll need to sign any script that's run from a UNC path like that.
November 7, 2013 at 6:19 am #11265ParticipantPoints: 14Rank: Member
Network shares are considered remote not local. I have run into the same problem too. Even if it's a mapped drive letter it is still "remote"
The topic ‘Using -executionpolicy bypass -file?’ is closed to new replies.