Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I bypass execution policy when running scripts from Powershell ISE

Tags:

powershell

So I can write a script in Powershell ISE, not save it, and it will run (F5/green arrow on the ISE). Once I save it, I get the error saying I can't run saved scripts. If I open a Powershell window in the directory the saved script exists, I can run it with

powershell -ExecutionPolicy ByPass -File script.ps1

But is there a way I can get this to work when running it via the ISE's green arrow/F5? I don't have admin access to this PC

Edit: Windows 10

like image 474
Tommy K Avatar asked Jan 28 '23 02:01

Tommy K


1 Answers

Ok so I just found out you can set Execution Policy for yourself (current user) without having admin rights. So if you're coming here from google do this:

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"

like image 94
Tommy K Avatar answered Feb 08 '23 15:02

Tommy K