Setting Permissions to Run PowerShell Scripts
When PowerShell is installed, it sets the default execution policy to Restricted which allows commands to be executed, not scripts. I donâ€™t think this is the best approach for the application since the scripting is the main reason why people would install and use PowerShell.
You can determine what the execution policy is with this command:
There are 4 options for execution policy: Restricted, AllSigned, RemoteSigned, and Unrestricted. The last 3 options allow scripts to be run in the shell. I prefer using the RemoteSigned policy over AllSigned because it doesnâ€™t require a digital signature from a trusted publisher to run scripts.
You can set the execution policy for running scripts with the following command: