2016-09-15 187 views
0

我有一個PowerShell腳本來運行MSU文件批處理文件運行PowerShell的

Start-Process wusa.exe \\hqfs1\users\tantony\PowerShell\WinUpdate\Win7AndW2K8R2-KB3134760-x64.msu 

然後,我有一個運行PowerShell腳本

powershell -ExecutionPolicy ByPass -noexit "& ""\\hqfs1\users\tantony\PowerShell\WinUpdate\winupdate.ps1""" /quiet /norestart 

一個批處理文件,有沒有一種方式來增加/quiet /norestart在批處理文件中,以便msu在沒有用戶交互的情況下靜默運行?

+0

的參數似乎已經在批處理腳本。你問如何將它們傳遞給PowerShell腳本中的'wusa.exe'? –

+0

是的,我問如何將它們傳遞給powershell腳本中的wusa.exe。我只是在早些時候進行測試,在發佈之前我忘了拿出'/ quiet/norestart'。 –

回答

0

像這樣的東西應該工作:

$update = '\\hqfs1\users\tantony\PowerShell\WinUpdate\Win7AndW2K8R2-KB3134760-x64.msu' 
Start-Process wusa.exe ((,$update + $args) -join ' ') 
+0

謝謝Ansgar Wiechers,但它仍然顯示了wusa.exe窗口。我正在嘗試進行無提示安裝。 –

+0

如果您正確傳遞'/ quiet'和'/ norestart'參數,代碼就是這樣。請提供證據。 –