If you (or a helpful admin) runs Set-ExecutionPolicy as administrator, the policy will be set for all users. (I would suggest 'remoteSigned' rather than 'unrestricted' as a safety measure.) NB.: On a 64-bit OS you need to run Set-ExecutionPolicy for 32-bit and 64-bit PowerShell separately.
By default, PowerShell restricts running scripts on end user PCs. This setting is good from a security point of view. However, if you are using a lot of scripts that you have downloaded or coded by yourself, it can be really annoying. In this article, we will review how to change the default execution policy for PowerShell scripts in Windows 10.
RECOMMENDED: Click here to fix Windows errors and optimize system performance
If the execution policy is not set and not configured, it is displayed as 'Undefined'. Here is how you can see the current value.
How to see the PowerShell Execution Policy
The command will display all execution policies. As you can see, there are a number of scopes for which the execution policy can be defined. It can be set globally for all users, for the current user only, or for the current process. The current process policy has priority above the current user's settings. The current user policy overrides the global option. Keep this in mind. Now, let's see how to change the script execution policy for PowerShell.
Change the PowerShell Execution policy for a process
This will start your script using the Unrestricted execution policy. Instead of the script, you can start a cmdlet or what you want. Instead of 'Unrestricted', you can use any other policy mentioned above.
Tip: For an open PowerShell console, you can switch the execution policy using the command:
It will remain active until you close the current PowerShell window.
Change PowerShell Execution policy for the current user
Tip: If the policy is not set after the command above, try to combine it with the -Force argument, like this:
When the execution policy is set for the current user, it will override the 'LocalMachine' scope. Again, for a process, you can override it for the current PowerShell instance as described above.
Change the global PowerShell Execution policy
This execution policy applies to the computer, meaning it is effective for those user accounts which have no execution policy applied individually. With the default settings, it will be applied to all user accounts.
To change the PowerShell Execution policy in Windows 10, do the following.
You are done.
Change PowerShell Execution policy with a Registry tweak
It is possible to change the execution policy with a Registry tweak for both the current user and the computer. Here is how it can be done.
Tip: See how to go to a Registry key with one click. Also, you can switch between HKCU and HKLM in Windows 10's Registry Editor quickly.
That's it.
RECOMMENDED: Click here to fix Windows errors and optimize system performance
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |