Powershell execution setting is overridden by a policy

Boopathi Subramaniam 3,301 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 Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 14,021 Reputation points MVP
    2021-08-10T09:35:10.857+00:00

    Hi @Boopathi Subramaniam

    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.

    9 people found this answer helpful.

  2. Rich Matheisen 45,906 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".

    2 people found this answer helpful.
    0 comments No comments

  3. Boopathi Subramaniam 3,301 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

    1 person found this answer helpful.
    0 comments No comments

  4. hamdou Rabi wane 0 Reputation points
    2024-01-31T19:33:23.39+00:00

    I am still having issue with this