PowerShell:- Check your execution policy

You may have noticed that when you want to run that PowerShell script you downloaded it gives you an error. This is because windows is designed to protect the operating system.

If you are running Windows Server, the default is set to remote signed. On Windows client machines, it is set to restricted.

Restricted means you can pretty much not do much and it protects the system so that malicious scripts cannot execute.

If you go and change the execution policy to unrestricted, you risk having unsigned scripts execute on your machine. Sometimes you need to install a package but you should set your execution policy back to what it was.

To find out what is applied, you can run the following command from a PowerShell (elevated) window:

  • Get-ExecutionPolicy

If you want to list all of them and see the scope, you can do so by running the following command:

  • Get-ExecutionPolicy -list

If you want to set the execution policy on machines in your organization, you can do so using Group Policy.

Hope it helps.

You may also like...

Leave a Reply