Here is a Powershell script you can use if you want to check what the Execution Policy on the machine is set to and if it isn’t equal to what you want, it will change it for you.

In this example, the script checks if the Execution-Policy is set to RemoteSigned, and if it is not, it will change it to RemoteSigned.

Note that running this script won’t work if the Execution Policy is set to Restricted, which is the default value.