When first time of power shell were disabled there execution policy. so let check first
>Get-ExecutionPolicy
Restricted
// if it show restricted means, that was the problem. you have to enable
there are four types
Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned - Only scripts signed by a trusted publisher can be run.
RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
>Set-ExecutionPolicy RemoteSigned
or if you get signature error then you need to type
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
now you can able to execute your power-shell script.
>Get-ExecutionPolicy
Restricted
// if it show restricted means, that was the problem. you have to enable
there are four types
Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned - Only scripts signed by a trusted publisher can be run.
RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted - No restrictions; all Windows PowerShell scripts can be run.
>Set-ExecutionPolicy RemoteSigned
or if you get signature error then you need to type
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
now you can able to execute your power-shell script.
No comments:
Post a Comment