【问题标题】:How to execute a PostGre exe file with silent mode?如何以静默模式执行 PostGre exe 文件?
【发布时间】:2014-10-10 15:45:59
【问题描述】:

喂,

我会在 Windows Server 2012 上安装 PostGreSQL 9.1。 我想使用 PowerShell 脚本。 对于我的 JDK 可执行文件,我使用 Start-Process "Myfile" -ArgumentList "/s" -Wait 但是参数\s 不适用于我的 PostGre 可执行文件。

你有什么想法吗?

【问题讨论】:

  • 这属于 superuser.com 或 serverfault.com 。假设“postgre exe”文件的意思是“PostgreSQL 安装程序”……阅读它的手册。它有关于静默安装选项的文档。或搜索“postgresql 静默安装窗口”。

标签: windows powershell executable postgresql-9.1 windows-server-2012


【解决方案1】:

您可以使用 Install-Postgres Powershell 模块,它位于 TechNet Gallery

Install-PostgreSQL PowerShell 模块执行以下操作:

  • 创建 PostgreSQL 将使用的本地 windows 用户
  • 下载 EnterpriseDB 提供的 PostgreSQL 安装程序
  • 使用提供的参数在无人值守的情况下安装 Postgres
  • 将 postgres windows 用户设置为 Postgres 文件和文件夹的所有者
  • 设置 Postgres windows 服务在 postgres 本地用户下运行
  • 在 AppData 中创建 pgpass.conf 文件
  • 将配置文件复制到数据目录
  • 打开 PostgreSQL 将在 Windows 中使用的提供的端口 防火墙

用法

Import-Module Install-Postgres
Install-Postgres -User "postgres" -Password "ChangeMe!"

【讨论】:

    【解决方案2】:

    我用过这个命令:Start-Process $installFile -ArgumentList "--unattendedmodeui minimal --mode unattended --prefix $dest --datadir $dest\data --servicepassword $pwd" -Wait

    感谢您的帮助! :)

    【讨论】:

      猜你喜欢
      • 2022-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      • 1970-01-01
      • 2012-09-15
      • 2013-09-13
      相关资源
      最近更新 更多