3

I'm trying to install postgresql using Chocolatey nuget and I get the following error:

Write-Error : postgresql did not finish successfully. Boo to the chocolatey gods!

[ERROR] Exception calling "SetInfo" with "0" argument(s): "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.

This is because the username being set is postgres and the password is Postgres1234 and so I suppose you aren't allowed your username in your password.

Is there a way to pass in the password as a parameter to the chocolatey installation? Or alternatively some Powershell magic I can use to alter the password rules while I run the package?


Update: my pull request to change the password in the PG 8 and 9 packages has been accepted so this issue should go away once that new version of the package is visible via choco install

Community
  • 1
  • 1
Paul D'Ambra
  • 7,629
  • 3
  • 51
  • 96

1 Answers1

1

So, I've managed to disable the password complexity requirements using:

#Postgres cannot install because the password contains the username so
Mkdir c:\temp -ErrorAction SilentlyContinue
secedit /export /cfg c:\temp\secpol.cfg
(gc c:\temp\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | sc C:\temp\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\temp\secpol.cfg /areas SECURITYPOLICY 
rm -force c:\temp\secpol.cfg -confirm:$false
#then install
cinst postgresql
cinst pgadmin3

The secedit calls are a modified version of the answer found here. That answer doesn't save the changes to the secpol file that is added here with | sc C:\temp\secpol.cfg

Obviously if you come here and paste this code... you should consider turning complexity back on afterwards.

I'm still interested in a better way of solving this issue...

Community
  • 1
  • 1
Paul D'Ambra
  • 7,629
  • 3
  • 51
  • 96
  • So this is prolly easy enough to fix. The package is over at https://github.com/ferventcoder/chocolatey-packages although you could edit the chocolateyInstall.ps1 to change the password and then do a -force install to have a more secure password. Please note that this ability is going away as the rewrite will remove the package on -force and reinstall the same version. – ferventcoder Nov 03 '14 at 19:51