An execution policy is a machine-wide PowerShell setting that controls whether and under what conditions scripts can run.
An execution policy is a machine-wide PowerShell setting that controls whether scripts can run. On Windows 10, Restricted is the default: interactive commands work, but scripts do not. section 4.1.1
View or change the policy using these administrative paths:
Run Get-ExecutionPolicy to view the current setting. section 4.1.1
Run Set-ExecutionPolicy to change the local setting; this usually requires administrator permission. section 4.1.1
Use a Group Policy Object when centralized policy should override the local setting. section 4.1.1
Start PowerShell.exe with -ExecutionPolicy to override local and Group Policy settings for that invocation. section 4.1.1
File C:\Scripts\Get-DiskInventory.ps1 cannot be loaded because the execution
of scripts is disabled on this system. Please see "get-help about_signing"
for more details.
Use the representative error message to recognize when a script is blocked because script execution is disabled. section 4.1.1
How Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS covers it
How deep it goes
Defines policy effects and three configuration paths, but does not detail all policy levels or signing behavior.
Examples
Uses Get-ExecutionPolicy, Set-ExecutionPolicy, PowerShell.exe -ExecutionPolicy, a blocked script error, and Group Policy settings.
What it assumes
Assumes PowerShell command use and distinguishes interactive commands from scripts; introduces policy administration and permission requirements.
What you can do after
Operate/configure it by inspecting policy and selecting local, Group Policy, or command-line settings.
How it connects
Connects execution policy with PowerShell scripts, Windows Registry, Group Policy Objects, and PowerShell.exe.
Set-ExecutionPolicyused by · Set-ExecutionPolicy is a PowerShell cmdlet that changes the execution policy for a specified scope.
shell scriptconfigures · Bash is a Unix command-line shell and scripting language for executing commands interactively and through scripts.
This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS. The section links point to the parts of the book it draws on.