我想做一个powershell脚本,自动安装所有的Windows,但我有一些困难得到是正确的。我的脚本运行良好,但我唯一的问题是脚本仍然需要用户输入才能工作。我尝试了多个参数强制安装,但每个参数仍然迫使我压缩操作。
用户输入:
确认您确实要执行此操作吗?在目标“桌面-xxxxxxx”上执行"(xxxxxxx) Microsoft -其他硬件- for Windows212KB“操作。Y是A是所有N No L No to All S暂停帮助(默认值为"Y"):
我用的剧本。
Set-ExecutionPolicy Unrestricted Install-Module PSWindowsUpdate Start-Transcript -Path "C:\temp\" Get-WindowsUpdate Install-WindowsUpdate Get-WindowsUpdate install IgnoreUserInput -acceptall -AutoReboot你能帮我得到正确的参数来强制安装更新吗?
发布于 2022-07-06 16:16:19
如果要编写"oneliner",则必须将脚本行正确地按";“分隔。
Set-ExecutionPolicy Unrestricted; Install-Module PSWindowsUpdate; Start-Transcript -Path "C:\temp\filename.txt"; Get-WindowsUpdate; Install-WindowsUpdate -IgnoreUserInput -acceptall -AutoReboot -ForceInstall当您开始-转录使用路径文件(而不是目录)。
使用-ForceInstall参数。
https://stackoverflow.com/questions/72886406
复制相似问题