# Using -executionpolicy bypass -file?

**URL:** <https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035>\
**Category:** PowerShell Help\
**Created:** [November 6, 2013, 7:12am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035 "2013-11-06T07:12:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bustedflush](https://avatars.discourse-cdn.com/v4/letter/b/77aa72/32.png) [@bustedflush](https://forums.powershell.org/u/bustedflush)\
**Post date:** [November 6, 2013, 7:12am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/1 "2013-11-06T07:12:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [November 6, 2013, 7:18am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/2 "2013-11-06T07:18:09Z")

</div>

Run this command at a PowerShell console, and post the results:

```
Get-ExecutionPolicy -List
```

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

```

---

<div class="post-metadata">

**Author:** ![bustedflush](https://avatars.discourse-cdn.com/v4/letter/b/77aa72/32.png) [@bustedflush](https://forums.powershell.org/u/bustedflush)\
**Post date:** [November 6, 2013, 7:25am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/3 "2013-11-06T07:25:32Z")

</div>

```
                                                  Scope ExecutionPolicy
                                                  ----- ---------------
                                          MachinePolicy RemoteSigned
                                             UserPolicy Undefined
                                                Process Undefined
                                            CurrentUser Undefined
                                           LocalMachine RemoteSigned

```

---

<div class="post-metadata">

**Author:** ![bustedflush](https://avatars.discourse-cdn.com/v4/letter/b/77aa72/32.png) [@bustedflush](https://forums.powershell.org/u/bustedflush)\
**Post date:** [November 6, 2013, 8:17am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/4 "2013-11-06T08:17:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [November 6, 2013, 9:19am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/5 "2013-11-06T09:19:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vern\_anderson](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/vern_anderson/32/5140_2.png) [@vern\_anderson](https://forums.powershell.org/u/vern_anderson)\
**Post date:** [November 7, 2013, 12:49am UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/6 "2013-11-07T00:49:33Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:56pm UTC](https://forums.powershell.org/t/using-executionpolicy-bypass-file/2035/7 "2024-05-16T20:56:55Z")

</div>


