If you are getting an error like “execution of scripts is disabled on this system”, that means script execution is disabled in your system using PowerShell execution policy. In order to enable script execution you need to set the execution policy from Restricted to ByPass (safe) or Unrestricted (Unsafe).
1 2 3 4 5 |
## Get the current execution policy Get-ExecutionPolicy ## Set execution policy to ByPass Set-ExecutionPolicy ByPass -Scope CurrentUser |
If you don’t have proper access to set execution policy, then simply bypass for a specific script that you want to execute.
1 2 |
## You can even set execution policy for a specific script powershell -ExecutionPolicy Bypass -File script.ps1 |
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy