So now that we know how to set them and remove them,
it's important to understand the impact an execution policy has on
things like PowerShell commands and scripts.
So first off, it's important to know the policy precedence.
So our first one is Group Policy.
The MachinePolicy is the first one in the order.
Second will be the UserPolicy.
Then we have the Process policy that runs for that single session.
Then we have the CurrentUser.
And then we have the LocalMachine.
So if we have a policy at Group Policy, UserPolicy level,
which is number two, but then we also have set one at the LocalMachine,
it will be the LocalMachine that effectively takes over at that point.
Now once we know the precedence,
we also need to know the execution policy impact depending on what we set,
whether we set AllSigned, Remote, Bypass,
etc.
So if we chose AllSigned, scripts can run,
you must sign all the scripts,
and it will prompt before execution from anywhere that's untrusted.
If we choose RemoteSigned,
the scripts can run again. You must sign all the downloaded
scripts. There's no signing for local,
and there is support for what's called Unblock‑File command.
The Unblocked‑File command allows you to take a file that
might have been downloaded from the internet and then
unblock that to allow execution.
Obviously, if you're set to Bypass, nothing is blocked, no warnings or prompts.
If we go to Restricted, then this supports executing commands,
but does block all of those file types.
And then Unrestricted, you can execute unsigned,
it warns before execution,
and you can run every single type of file extension for PowerShell.