Powershell Tutorial Online


Set ExecutionPolicy on the Server PowerShell is secure by default. The first thing keep in mind that PowerShell won't execute scripts until you allowd to execute it means explicitly you have to give it permission to do so. PowerShell has four execution policies that govern how it should execute scripts

No scripts allowed
You can set PowerShell’s execution policy by using the following cmdlet: PowerShell won't run any scripts. This is PowerShell's default execution policy

No requirements; all scripts allowed
PowerShell ignores digital signatures but will still prompt you before running a script downloaded from the Internet.

All local scripts allowed; only signed remote scripts.
PowerShell won't run scripts downloaded from the Internet unless they have a digital signature, but scripts not downloaded from the Internet will run without prompting. If a script has a digital signature, PowerShell will prompt you before it runs a script from a publisher it hasn't seen before.

All scripts need to be signed
PowerShell will only run scripts that are signed with a digital signature. If you run a script signed by a publisher PowerShell hasn't seen before, PowerShell will ask whether you trust the script's publisher.

    Set-ExecutionPolicy  #any of the policy form 4 execution policies 

if you wanted to allow scripts to run in an unrestricted manner you could type:
 PS c:\ Set-ExecutionPolicy Unrestricted

Restricted -- Restricted is the default execution policy and locks PowerShell down so that commands can be entered only interactively. PowerShell scripts are not allowed to run.
All Signed -- If the execution policy is set to All Signed then scripts will be allowed to run, but only if they are signed by a trusted publisher.
Remote Signed -- If the execution policy is set to Remote Signed, any PowerShell scripts that have been locally created will be allowed to run. Scripts created remotely are allowed to run only if they are signed by a trusted publisher.
Unrestricted -- As the name implies, Unrestricted removes all restrictions from the execution policy.