Powershell execution setting is overridden by a policy

Boopathi S 3,806 Reputation points
2021-08-09T18:51:17.59+00:00

Hi,
I am getting the below message when i run any powershell command. Please let me know which policy is blocking to run the powershell command

121690-capture.jpg

Windows for business Windows Server User experience PowerShell
{count} votes

3 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 15,256 Reputation points MVP Volunteer Moderator
    2021-08-10T09:35:10.857+00:00

    Hi @Boopathi S

    You must set the PowerShell Execution Policy from Restricted to RemoteSigned or Unrestricted to allow local PowerShell scripts to run.

    For more information about PowerShell Execution Policy, type help about_signing or help Set-ExecutionPolicy at the PowerShell command prompt.

    Procedure

    1. Select Start > All Programs > Windows PowerShell version > Windows PowerShell.
    2. Type Set-ExecutionPolicy RemoteSigned to set the policy to RemoteSigned.
    3. Type Set-ExecutionPolicy Unrestricted to set the policy to Unrestricted.
    4. Type Get-ExecutionPolicy to verify the current settings for the execution policy.
    5. Type Exit.

    121918-image.png

    If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.

    11 people found this answer helpful.

  2. Rich Matheisen 47,901 Reputation points
    2021-08-09T19:11:20.28+00:00

    Execution policies are hierarchical. See here: about_execution_policies or "help about_Execution_Policies"

    Your "MachinePolicy" is "AllSigned". That takes precedence over "Process".

    3 people found this answer helpful.
    0 comments No comments

  3. Boopathi S 3,806 Reputation points
    2021-08-10T12:01:18.657+00:00

    Hello RichMatheisen and Learn2Skills,

    Thank your for your help. I changed the registry settings as per below command and it worked.

    https://vladtalkstech.com/2014/03/change-powershell-machinepolicy-execution-policy-windows-server-2012r2.html

    Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\PowerShell -Name ExecutionPolicy -Value ByPass

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.