无人值守/静默安装记事本++



我一直在尝试在完全无人值守的众多远程服务器上安装记事本++版本7.5.6。我已经研究并找到了静音开关'/S'但它在我本地环境中无法正常工作。当我运行以下代码时,它仍然会为该语言生成一个弹出窗口,就像我手动单击安装程序一样。

start-process -FilePath "$Pathnpp.7.5.6.Installer.x64.exe" -ArgumentList '/S' -wait

据我所知,这不应该产生任何弹出窗口,但它确实如此,从用户帐户控制开始。

任何人都可以弄清楚我做错了什么以及如何让安装程序在没有任何弹出窗口的情况下完全无人值守地运行?

正如@TheIncorrigible1所说,你需要使用 -Verb runas

start-process -FilePath "$Pathnpp.7.5.6.Installer.x64.exe" -ArgumentList '/S' -Verb runas -Wait

在原始答案中添加更多内容。

我希望每次都安装最新版本,所以我最终使用PowerShell脚本执行此操作:

$LocalTempDir = $env:TEMP
$href = ((Invoke-WebRequest -Uri 'https://notepad-plus-plus.org/downloads/').Links | Where-Object { $_.innerText -match 'current version' }).href
$downloadUrl = ((Invoke-WebRequest "https://notepad-plus-plus.org/$href").Links | Where-Object { $_.innerHTML -match 'installer' -and $_.href -match 'x64.exe' }).href
Invoke-RestMethod $downloadUrl -OutFile "$LocalTempDir/np++.exe"
start-process -FilePath "$LocalTempDirnp++.exe" -ArgumentList '/S' -Verb runas -Wait

最新更新