Loading...

Powershell Tip : Run a ps1 without changing the executionpolicy rules

Reply A+ A-

In order to run a powershell script (.ps1) on a computer, you have to change the executionpolicy rules. 


To see which policy is applied on your computer you type " set-executionpolicy " on the powershell prompt.

By default this policy is set to " Restricted ".


If you want to change it you have to type " set-executionpolicy remotesigned ", as an example.





To avoid changing this policy, you can run your ps1 using the below commandline.

c:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -stan -WindowStyle Hidden -noprofile -executionpolicy bypass -file "name of your ps1file.ps1"

Scripting 1810637861170527529

Enregistrer un commentaire

Accueil item

Award

Learn KQL in one month

Sponsors

You want to support me ?

Mes articles en français

Books in French


Stats