ExecutionPolicy parameter

powershell.exe -? says there is a parameter ExecutionPolicy

when I try to run

c:\ > powershell.exe -executionPolicy Unrestricted -command “Get-ExecutionPolicy”




you can run it like this to get the expected output:
powershell.exe -executionPolicy Unrestricted -command “Get-ExecutionPolicy -Scope Process”

I hope this helps.

but i still cannot run remote scripts…

You specify the script path with -File parameter?


That is odd,

I’ve just downloaded a script from Script Center to try it on my machine and it works as expected.
My execution policy is RemoveSigned so i cannot run it in normal powershell window, but it works if i run it like this
powershell.exe -executionPolicy Unrestricted -command “Get-ExecutionPolicy -Scope Process” -File “C:\Users\Desktop\ActiveSyncReport.ps1”

forget all i worte before. it doesnt work here too.

you are trying to run local script

powershell.exe -executionPolicy Unrestricted -File "\some\network\share\script.ps1

Just edited my last post, it’s not working for me too

After some more digging around, i think the this is an issue of executionpolicy scope precedence, its described here:


i got a clue to this by running “Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted” and getting an the following error:
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will
retain its current effective execution policy of RemoteSigned. Type “Get-ExecutionPolicy -List” to view your execution policy settings. For more information please see “Get-Help Set-ExecutionPolicy”.
At line:1 char:1

Looks like you’ve got an execution policy being assigned by Group Policy, which is why your effective policy is still set to RemoteSigned. You can see more detail with: powershell.exe -ExecutionPolicy Bypass -Command Get-ExecutionPolicy -List

If the MachinePolicy or UserPolicy options are anything other than “Undefined”, then they will take precedence over everything else in the list (including Process, which is what gets set by powershell.exe’s parameter.

Noam, Dave thanks a lot

now it is clear to me