Introduction

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.

The Powershell snippet

$Policy = "RemoteSigned" 
If ((Get-ExecutionPolicy) -ne $Policy) {    
 Set-ExecutionPolicy $Policy -Force   
Exit
}

References

Related posts

LEAVE A REPLY

Please enter your comment!
Please enter your name here