我正在尝试使用 Chocolatey nuget 安装 postgresql,但出现以下错误:
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.
这是因为设置的用户名是 postgres,密码是 Postgres1234,所以我想 you aren't allowed your username in your password .
有没有办法将密码作为参数传递给巧克力安装? 或者我可以在运行包时使用一些 Powershell 魔法来更改密码规则?
更新:我的pull request在 PG 8 和 9 包中更改密码已被接受,因此一旦通过 choco install
最佳答案
因此,我设法使用以下方法禁用了密码复杂性要求:
#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
secedit 调用是答案 found here 的修改版本.该答案不会将更改保存到此处使用 | 添加的 secpol 文件。 sc C:\temp\secpol.cfg
很明显,如果您来到此处并粘贴此代码...您应该考虑之后重新启用复杂性。
我仍然对解决这个问题的更好方法感兴趣...
关于powershell-2.0 - 当我收到密码复杂性错误时如何使用 Chocolatey Nuget 安装 Postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26715449/