windows update, use explicit reboot policy (#1143)

This commit is contained in:
Sam Hug
2025-07-14 00:57:00 -07:00
committed by GitHub
parent f8c910a3c2
commit 1114556661
3 changed files with 29 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ impl Powershell {
#[cfg(windows)]
mod windows {
use super::*;
use crate::config::UpdatesAutoReboot;
pub fn supports_windows_update(powershell: &Powershell) -> bool {
powershell
@@ -174,6 +175,11 @@ mod windows {
if ctx.config().accept_all_windows_updates() {
command_str.push_str(" -AcceptAll");
}
match ctx.config().windows_updates_auto_reboot() {
UpdatesAutoReboot::Yes => command_str.push_str(" -AutoReboot"),
UpdatesAutoReboot::No => command_str.push_str(" -IgnoreReboot"),
UpdatesAutoReboot::Ask => (), // Prompting is the default for Install-WindowsUpdate
}
// Pass the command string using the -Command flag
powershell