使用 PowerShell 脚本以参数静默方式安装 msi 应用程序失败

使用 PowerShell 脚本以参数静默方式安装 msi 应用程序失败

我尝试使用 Powershell 脚本和一些参数静默安装 msi 应用程序,但失败了。我从 msiexec 获取的日志根本没有帮助。

我认为这是我的代码中的参数错误:

$logFile = "test.log"
$path = "C:\Program Files\MyApp\"
$Arguments = @(
"/i"
('"{0}"' -f $file.fullname)
"/qn"
"/norestart"
 "WIXUI_INSTALLDIR="$path""
 "STARTMENU_SHORTCUT=1"
 "STARTUP_SHORTCUT=1"
 "DESKTOP_SHORTCUT=1"
 "OPERATOR_ROLE=Master"
 "ID=00:00:00:00"
"/l*v"
$logFile
)
Start-Process "msiexec.exe" -ArgumentList $Arguments -Wait -NoNewWindow 

Q1.) 我是否需要说明 msi 安装程序使用的所有参数?(注意:我知道 wix 安装程序对 gui 安装程序中的所有输入都有默认值)

Q2.) 字符串的格式正确吗?

Q3.) 我可以获得比这里写的更多的日志吗?(抱歉日志的格式)

=== Verbose logging started: 2020-09-17  15:56:13  Build type: SHIP UNICODE 5.00.10011.00  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (F0:60) [15:56:13:461]: Resetting cached policy values
MSI (c) (F0:60) [15:56:13:461]: Machine policy value 'Debug' is 0
MSI (c) (F0:60) [15:56:13:461]: ******* RunEngine:
        ******* Product: 
        ******* Action: 
        ******* CommandLine: **********
MSI (c) (F0:60) [15:56:13:461]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (F0:60) [15:56:13:461]: Grabbed execution mutex.
MSI (c) (F0:60) [15:56:13:465]: Cloaking enabled.
MSI (c) (F0:60) [15:56:13:465]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (F0:60) [15:56:13:466]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (08:D8) [15:56:13:469]: Running installation inside multi-package transaction C:\Users\Developer\Downloads\archive\Binaries\InstallFiles\Windows\
MSI (s) (08:D8) [15:56:13:469]: Grabbed execution mutex.
MSI (s) (08:38) [15:56:13:470]: Resetting cached policy values
MSI (s) (08:38) [15:56:13:470]: Machine policy value 'Debug' is 0
MSI (s) (08:38) [15:56:13:470]: ******* RunEngine:
        ******* Product: C:\Users\Developer\Downloads\archive\Binaries\InstallFiles\Windows\
        ******* Action: 
        ******* CommandLine: **********
MSI (s) (08:38) [15:56:13:470]: Note: 1: 2203 2: C:\Users\Developer\Downloads\archive\Binaries\InstallFiles\Windows\ 3: -2147287037 
MSI (s) (08:38) [15:56:13:470]: MainEngineThread is returning 3
MSI (s) (08:D8) [15:56:13:471]: User policy value 'DisableRollback' is 0
MSI (s) (08:D8) [15:56:13:471]: Machine policy value 'DisableRollback' is 0
MSI (s) (08:D8) [15:56:13:471]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (08:D8) [15:56:13:471]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (08:D8) [15:56:13:471]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (08:D8) [15:56:13:472]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (F0:60) [15:56:13:472]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (F0:60) [15:56:13:473]: MainEngineThread is returning 3
=== Verbose logging stopped: 2020-09-17  15:56:13 ===

相关内容