2016-09-15 186 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'参数,代码就是这样。请提供证据。 –