How can I use Invoke-Wuinstall silently

怎甘沉沦 提交于 2020-01-04 14:04:04

问题


$WUInstallScript = { Import-Module C:\Path\PSWindowsUpdate.psm1; Get-WUInstall -AcceptAll -AutoReboot}
Invoke-WUInstall -ComputerName $hostname -Script $WUInstallScript

I am running this command but Invoke-WUInstall pops up that whether I want to confirm this action. I want to invoke this silently. Is there any option to do this?


回答1:


Add -Confirm:$false switch like this:

Invoke-WUInstall -ComputerName $hostname -Script $WUInstallScript -Confirm:$false



回答2:


I use a wu.ps1 file containing:

Import-Module PSWindowsUpdate
Invoke-Command  {Get-WUInstall -AcceptAll -AutoReboot -Confirm:$FALSE}

and then something like:

powershell -file "C:\usr\wu.ps1"


来源:https://stackoverflow.com/questions/25397197/how-can-i-use-invoke-wuinstall-silently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!