Share via

While installing Postgresql i am geting "There has been an error. Error running C:\WINDOWS\System32\Windows PowerShell\v1.0\powershell.exe -Execution Policy Bypass -File "C:\Users\\AppData\Local\Temp \postgresql_installer_442a74a242\getlocales.ps1""

Jagadeesh Kumar 20 Reputation points
2026-04-10T00:17:24.38+00:00

I am getting the above mentioned error while installing PostgreSQL in my laptop Can anyone help me in this regard

User's image

Windows for home | Other | Apps
0 comments No comments

Answer accepted by question author

Lychee-Ng 19,950 Reputation points Microsoft External Staff Moderator
2026-04-10T10:48:15.68+00:00

Please note that our forum is a public platform, and we will modify your question to hide your personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.

Hi Jagadeesh Kumar,

I understand how frustrating it is when your PostgreSQL installer fails with a PowerShell error before it even finishes. From the error message in your screenshot, this is likely a PostgreSQL installer issue more than Windows itself. Here’s what you can try:

1 - Re‑run the installer from a simple path

  • Check whether your Temp folder is accessible:
    • Press Win + R > type %TEMP% > press Enter
    • If that fails, it means the installer cannot find its script
  • Run the PostgreSQL installer again but from more simple location:
    • Redownload it (e.g. to C:\Downloads\PostgresSQL folder)
    • Right‑click the installer > Run as administrator.

2 - Temporarily allow the installer’s PowerShell script

  • Press Win + X > Open Windows PowerShell / Terminal as Administrator
  • Run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  • Keep that window open > run the PostgreSQL installer again.

3 - If the installer keeps failing

  • Download the ZIP version of PostgreSQL
  • Extract it to a simple folder like C:\Downloads\PostgreSQL
  • PostgreSQL can work normally this way, just without the setup wizard.

If the issue persists, let me know if there’s any new error appear when you attempt to open the Temp folder or trying the PowerShell script.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. nobuko c 123.7K Reputation points Independent Advisor
    2026-04-10T12:39:10.8133333+00:00

    Hello,

    This issue occurs because PowerShell script execution is restricted during the PostgreSQL installation. As a workaround, please temporarily enable script execution in Group Policy.

    Press the Windows key + R at the same time, type gpedit.msc, and click OK.

    • Local Group Policy:

    Computer Configuration > Administrative Templates >Windows Components > Windows PowerShell > “Turn on Script Execution”

    Set this policy to:

    “Allow local scripts and remote signed scripts”

    After changing the setting, run the PostgreSQL installer again.

    Once the installation is complete, please revert the policy to its original state.

    Was this answer helpful?

    0 comments No comments

Your answer

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