Troubleshooting:
- Run install as admin -> same problem
- Disable AV + Firewall + Windows Defender -> same problem
- Edit C:\Windows\System32\drivers\etc\hosts -> reboot -> same problem
- Uninstalled AV -> same problem
- Disabled UAC -> same problem
- services.msc -> restart Secondary Logon Service -> same problem
- Installed to c:\postgresql and c:\pgdata for data directory -> same problem
- create folder C:\pgdata -> Properties -> Security -> Edit... -> Add... -> "postgres" -> OK -> Full Control -> same problem
- manually running initdb -D C:\pgdata -> same problem
- runas /user:postgres cmd.exe -> initdb -D C:\pgdata -> initdb successful, but when trying to "Start Server" -> "The system cannot find the path specified." -> checked services.msc -> no postgresql service was created during installation
Solution:
- Uninstall PostgreSQL
- net user postgres /delete
- Control Panel -> User Accounts -> Configure advanced user profile properties -> delete all "Unknown User" instances that seem to be left from postgres
- compmgmt.msc -> Local Users and Groups -> Users -> New User... -> User name: postgres, Password: postgrespass -> Create
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Administrators -> OK
- copy postgresql-8.4.9-1-windows.exe to C:\
- runas /user:postgres cmd.exe -> cd \ -> postgresql-8.4.9-1-windows.exe -> installed successfully without errors. Checked data folder and confirmed files created successfully.
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Administrators -> Remove
- compmgmt.msc -> Local Users and Groups -> Users -> postgres -> Member of -> Add... -> Power Users -> OK
- Installed HM2 -> created db successfully
- Restarted computer -> HM2 runs properly (i.e. just to check postgresql service starts automatically)