我想从PowerShell脚本执行以下行:
msiexec /qb /i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi CONFIGFILE="ALS GSLB.jnprpreconfig"
这从DOS命令行调用时,但MSIEXEC抱怨说,事情是不正确的,当我从PowerShell调用它。
这确实有效…
msiexec / qb / i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi
很明显,SOMETHING正在搞乱我的论点,但我无法弄清楚如何使它工作。
(删除了“/”)
我只是使用Powershell在我的核心服务器上安装GAPS,我有一个这样的命令。 我喜欢这个更详细的语法,因为它更具可读性,并且我可以在每个命令行选项中包含注释以保存我自己和其他人以后再次使用该命令。
$cmdhash=@{} $cmdhash['FilePath'] = 'C:\Windows\System32\msiexec.exe' $cmdhash['Wait'] = $true $cmdhash['NoNewWindow'] = $true $cmdhash['ArgumentList']=@() $cmdhash['ArgumentList'] += '/i \\esd189.org\dfs\wpkg\software\Google\GAPS\googleappspasswordsync64.msi' $cmdhash['ArgumentList'] += '/l*vx C:\programdata\gaps_msi_log.txt' $cmdhash['ArgumentList'] += '/quiet' $cmdhash['ArgumentList'] += 'DOMAIN="example.org"' $cmdhash['ArgumentList'] += 'ADMIN_EMAIL="[email protected]"' $cmdhash['ArgumentList'] += 'CREDENTIALS_FILE="\\ds-01\c$\Users\svc-googlesync\Documents\example.json"' $cmdhash['ArgumentList'] += 'BASE_DN="DC=example,DC=org"' $cmdhash['ArgumentList'] += 'MAIL_ATTRIBUTE="userPrincipalName"' # using splatting, run the process Start-Process @cmdhash
我不确定你的/CONFIGFILE=是否正确。 /CONFIGFILE似乎不是一个msiexec选项。 也许你应该跳过领先/为此? 如果这个斜杠应该被剥离,那么这个命令看起来就像这样。
$cmdhash=@{} $cmdhash['FilePath'] = 'C:\Windows\System32\msiexec.exe' $cmdhash['Wait'] = $true $cmdhash['NoNewWindow'] = $true $cmdhash['ArgumentList']=@() $cmdhash['ArgumentList'] += '/qb' $cmdhash['ArgumentList'] += '/i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi' $cmdhash['ArgumentList'] += 'CONFIGFILE="ALS GSLB.jnprpreconfig' Start-Process @cmdhash