Implementing a check for Windows 11 and, if detected, skipping Windows Update via usoclient.exe. It is suggested to install PSWindowsUpdate.

This commit is contained in:
Nils
2024-01-27 23:51:56 +01:00
parent 43a4d321cf
commit e1ef2e4bc5
3 changed files with 23 additions and 0 deletions

View File

@@ -13,6 +13,8 @@ use crate::utils::{require, which};
use crate::{error::SkipStep, steps::git::Repositories};
use crate::{powershell, Step};
use os_info;
pub fn run_chocolatey(ctx: &ExecutionContext) -> Result<()> {
let choco = require("choco")?;
let yes = ctx.config().yes(Step::Chocolatey);
@@ -212,6 +214,14 @@ pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {
return powershell.windows_update(ctx);
}
let info: os_info::Info = os_info::get();
let edition: String = info.edition().unwrap_or("Unknown").to_string();
if edition.contains("Windows 11") {
print_separator("Windows Update");
println!("Windows 11 does not support Windows Update via usoclient.exe. Consider installing PSWindowsUpdate");
return Ok(());
}
let usoclient = require("UsoClient")?;
print_separator("Windows Update");