Powershell scripts by default is set to restricted. So if you try to run a powershell script on a new machine you’ll find that it doesn’t work.
So here are the commands I use most often.
First off the default command is
Set-ExecutionPolicy -ExecutionPolicy Restricted
This is the command I run if this is a powershell script that will be ran all the time on that computer
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
And this is the one I use to just run something one time
Set-ExecutionPolicy -Scope Process -ExecutionPolicy AllSigned