wusa.exe 回傳代碼 5 是什麼意思?

wusa.exe 回傳代碼 5 是什麼意思?

我正在嘗試安裝透過 Chocolatey 在伺服器上安裝 powershell 4.0。它失敗了:

[錯誤] [錯誤] 使用C:\Users\jdearing\AppData\Local\Temp\chocolatey\Powershell4\Powershell4Install.msu /quiet /norestart /log:"C:\Chocolatey\lib\powershell4.4.0. 執行wusa.exe 。退出代碼為“5”。

我在應用程式日誌中沒有得到任何內容,並且該日誌似乎是二進位資料。我找不到 wusa.exe 的回傳代碼清單。

答案1

Windows 更新不允許您透過 Powershell 遠端會話執行安裝,因為它不允許任何遠端驗證令牌。這不僅會影響例行更新的執行,還會影響透過 dism 和 servermanager 以及許多 Microsoft MSI 安裝 Windows 功能。看起來 Windows Management 4 就在其中。解決此問題的最佳方法是建立計劃任務以在遠端電腦上執行此操作。如上所述,只要檔案存取連接埠打開,PSEXEC 也可以運作,並且如果您不在網域環境中,並且已啟用 LocalAccountTokenFilterPolicy。

我最近在 Boxstarter.org 2.0 版本中新增了此功能。透過此功能,您可以遠端安裝 Chocolatey 軟體包、Windows 功能或 Windows 更新,Boxstarter 將從遠端 Powershell 會話建立排程任務。它將輸出串流回您的會話,因此看起來和感覺就像是從會話內部運行一樣。看http://boxstarter.org/InstallingPackages#RemoteInstallations了解詳情。

簡而言之,該命令如下所示:

$cred=Get-Credential username
Install-BoxstarterPackage -ComputerName box1,box2 -Credential $cred -PackageName Powershell4

相關內容