Windows PowerShell Program is used to create a script or run a script in the Windows operating system. This script is used to reduce the administrative overhead. But when we try to run a script then the below error message appears.
"scriptname.ps1 cannot be loaded because running scripts is disabled on this system"
[Replace "scriptname.ps1" as your scriptname]
Now we will discuss this issue.
Considering the security reason, by default restricted value is selected for the "Set-ExecutionPolicy" rule. That means all scripts will be disabled. Nothing can be run. That's why we get that error message.
To run the script on our system, we have to change the "Set-ExecutionPolicy" value to "RemoteSigned" or "Unrestricted". Run the below command in your PowerShell prompt:-
Set-ExecutionPolicy RemoteSigned
or
Set-ExecutionPolicy Unrestricted
There are four available options to work with the "Set-ExecutionPolicy" rule.
Restricted = All scripts will be disabled. No permission to run any script.
AllSigned = Only run scripts that one signed by a trusted publisher.
RemoteSigned = Scripts that are downloaded have to be signed by a trusted publisher.
Unrestricted = All scripts can be run. There are no restrictions.
Select your value as your requirements.
That's all.
No comments:
Post a Comment