Received the below error on running a power shell script in a windows 10 machine 64 bit, after a fresh install.
I resolved the issue by updating the "Execution Policy" on the machine.
PS C:\Users\628351\Desktop> Get-ExecutionPolicy
Restricted
PS C:\Users\628351\Desktop> Get-ExecutionPolicy -List
Restricted
PS C:\Users\628351\Desktop> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
PS C:\Users\628351\Desktop> Get-ExecutionPolicy -Scope CurrentUser
Undefined
PS C:\Users\628351\Desktop>
PS C:\Users\628351\Desktop> Set-ExecutionPolicy -ExecutionPolicy UnRestricted -Scope LocalMachine
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
PS C:\Users\628351> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Unrestricted
PS C:\Users\628351>
No comments:
Post a Comment