Sometimes when you run a .ps1 powershell script :
you get error like :
.\SolutionManager : File D:\repo\sample.ps1 cannot be loaded. The file D:\repo\sample.ps1 is not digitally signed. You cannot run this script on the current system. For more
information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\SolutionManager
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
To fix it you have to run the command below to run Set-ExecutionPolicy and change the Execution Policy setting in your windows powershell windows.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
This command sets the execution policy to bypass for only the current PowerShell session after the window is closed, again the default settings will override.
Comments