PostgreSQL 8.3 and 8.4 may fail to install on Windows with the following error message: "An error occurred executing the Microsoft VC++ runtime installer". PostgreSQL 9.0 may fail with a different message: "Unable to write inside TEMP environment variable path", but the actual reason appears to be the same.
It turns out that the installer requires Windows Script Host to be enabled (there might be other reasons, but this is the problem I have stumbled upon).
Before you start messing with the registry, check if WSH is actually disabled or not. To do that run
Here is how to enable Windows Script Host for the current user (assuming he/she has administrator rights, of course):
The above may not work if Windows Script Host has been disabled system-wide. Here is how to enable it:
Again, if Windows Script Host is enabled, and PostgreSQL installation still fails, it must be related to something else that I have not encountered.
The above instructions are for Windows XP. They have been tested with PostgreSQL 8.3., 8.4 and 9.0.
They also have been tested on Windows 7 32-bit, but only PostgreSQL 8.4 has been installed.
The procedure should be similar on other versions of Windows.
I have received several reports about failed installation attempts on Windows 7 64-bit and none from Windows 7 32-bit users (or users of any other versions of Windows for that matter), which makes me suspect that this might be something specific to Windows 7 64-bit. Unfortunately, I do not have access to a machine with 64-bit Windows 7 needed to try to re-create the problem.
P.S. It had not occurred to me that WSH may be enabled, but the association between WSH and *.vbs files may be missing. It is indeed a possibility. Thanks to DIego, Rain and anonymous commenters for pointing it out.
P.P.S. If you are planning to use the
and
without WSH. So, there is hardly any real need to keep Windows Script Host enabled unless you need it for something else.
It turns out that the installer requires Windows Script Host to be enabled (there might be other reasons, but this is the problem I have stumbled upon).
Before you start messing with the registry, check if WSH is actually disabled or not. To do that run
wscript.exe
in the DOS box.- If you see a dialog box called "Windows Script Host Settings", WSH is enabled, and your problem with PostgreSQL installation must be related to something else.
- If you get an error box that says "Windows Script Host access is disabled on this machine. Contact your administrator for details", WSH is disabled, and your problem with PostgreSQL installationmay be related to it (or may be not).
Here is how to enable Windows Script Host for the current user (assuming he/she has administrator rights, of course):
- Start Registry Editor (Start => Run... => regedit).
- In the Registry Editor open
HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings
- Make sure you actually are "inside" the
Settings
"folder". - Right-click anywhere in the right pane of the Registry Editor and selectNew => DWORD Value and call it "Enabled". Then, double-click it and set the "Value data" field to "1".
- Check if WSH is now enabled by running
wscript.exe
in the DOS box (see above). - If WSH is enabled, try installing PostgreSQL. If not, see below how to enable WSH system-wide.
- Once the installation is complete, you can disable WSH by setting the "Enabled" value to "0".
The above may not work if Windows Script Host has been disabled system-wide. Here is how to enable it:
- Start Registry Editor (Start => Run... => regedit).
- In the Registry Editor open
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings
. Note that it is HKEY_LOCAL_MACHINE this time. - Make sure you actually are "inside" the
Settings
"folder". - Right-click anywhere in the right pane of the Registry Editor and selectNew => DWORD Value and call it "Enabled". Then, double-click it and set the "Value data" field to "1".
- Check if WSH is now enabled by running
wscript.exe
in the DOS box (see above). - If WSH is enabled, try installing PostgreSQL. If not, you may be using some third-party script blocker or something (I give up).
- Once the installation is complete, you can disable WSH by setting the "Enabled" value to "0".
Again, if Windows Script Host is enabled, and PostgreSQL installation still fails, it must be related to something else that I have not encountered.
The above instructions are for Windows XP. They have been tested with PostgreSQL 8.3., 8.4 and 9.0.
They also have been tested on Windows 7 32-bit, but only PostgreSQL 8.4 has been installed.
The procedure should be similar on other versions of Windows.
I have received several reports about failed installation attempts on Windows 7 64-bit and none from Windows 7 32-bit users (or users of any other versions of Windows for that matter), which makes me suspect that this might be something specific to Windows 7 64-bit. Unfortunately, I do not have access to a machine with 64-bit Windows 7 needed to try to re-create the problem.
P.S. It had not occurred to me that WSH may be enabled, but the association between WSH and *.vbs files may be missing. It is indeed a possibility. Thanks to DIego, Rain and anonymous commenters for pointing it out.
P.P.S. If you are planning to use the
serverctl.vbs
script that comes with the Windows installation of PostgreSQL 8.x, you might want to keep WSH enabled. This script allows you to conveniently start and stop PostgreSQL database server directly from the Windows menu, an option that is not critical, but nice to have, especially if you run PostgreSQL on a laptop and do not really want it to run in the background all the time. On the other hand, you can achieve exactly the same simply by runningNET START postgresql_service_name
and
NET STOP postgresql_service_name
without WSH. So, there is hardly any real need to keep Windows Script Host enabled unless you need it for something else.
No comments:
Post a Comment