# error on starting powershell -executionpolicy 

**URL:** <https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389>\
**Category:** PowerShell Help\
**Created:** [March 27, 2014, 1:20am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389 "2014-03-27T01:20:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![buzz-buzz](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@buzz-buzz](https://forums.powershell.org/u/buzz-buzz)\
**Post date:** [March 27, 2014, 1:20am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/1 "2014-03-27T01:20:26Z")

</div>

Hi, I am getting the following error on one of the servers I tested (it worked fine on other servers), what could be run?

Thanks!

Yung

C:&gt;powershell -ExecutionPolicy ByPass -File C:\Users\chengyu\Documents\UD\_stat  
us.ps1  
Missing expression after unary operator ‘-’.  
At line:1 char:2

- -E \<\<\<\< xecutionPolicy ByPass -File C:\Users\chengyu\Documents\UD\_status.ps1

C:&gt;

---

<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:** [March 27, 2014, 1:42am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/2 "2014-03-27T01:42:46Z")

</div>

Does that server have PowerShell v1 installed, by chance? The syntax you posted should be working on PowerShell 2.0 or later, but I’m not sure about 1.0 (which I never used.)

---

<div class="post-metadata">

**Author:** ![buzz-buzz](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@buzz-buzz](https://forums.powershell.org/u/buzz-buzz)\
**Post date:** [March 27, 2014, 2:35am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/3 "2014-03-27T02:35:09Z")

</div>

Yes, that server is v1. So this command is not working for v1? The problem is that some of the servers has executionpolicy set to “restricted” (i will run the script on many servers and I don’t want to change the policy manually on each one, nor do i want to change the registry to relax the policy). I thought -ExecutionPolicy ByPass would be the best choice, but then this problem occurs.

Thanks for responding.

Yung

---

<div class="post-metadata">

**Author:** ![bobmccoy](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bobmccoy/32/650_2.png) [@bobmccoy](https://forums.powershell.org/u/bobmccoy)\
**Post date:** [March 27, 2014, 6:35am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/4 "2014-03-27T06:35:11Z")

</div>

Unless you have a really compelling reason to stay at v1, you really should upgrade PowerShell. You don’t get all the remoting goodness until at least v2.

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [March 27, 2014, 6:36am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/5 "2014-03-27T06:36:55Z")

</div>

If I remember correctly ExecutionPolicy wasn’t available as a start-up parameter on PowerShell v1

---

<div class="post-metadata">

**Author:** ![buzz-buzz](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@buzz-buzz](https://forums.powershell.org/u/buzz-buzz)\
**Post date:** [March 27, 2014, 6:43am UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/6 "2014-03-27T06:43:16Z")

</div>

OK, looks like I have to rewrite my program using VB… If I had control, i would have forced them to upgrade powershell version.

Thanks all for your help!

---

<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:52pm UTC](https://forums.powershell.org/t/error-on-starting-powershell-executionpolicy/2389/7 "2024-05-16T20:52:16Z")

</div>


