fix(powershell): run microsoft_store command directly
This commit is contained in:
@@ -1256,14 +1256,6 @@ _version: 2
|
||||
zh_CN: "成功,Microsoft Store 应用正在后台更新"
|
||||
zh_TW: "成功,Microsoft Store 應用程式正在後台更新"
|
||||
de: "Erfolg, Microsoft Store-Apps werden im Hintergrund aktualisiert"
|
||||
"Unable to update Microsoft Store apps, manual intervention is required":
|
||||
en: "Unable to update Microsoft Store apps, manual intervention is required"
|
||||
lt: "Nepavyksta atnaujinti Microsoft Store programų, reikia rankinio įsikišimo"
|
||||
es: "No se pueden actualizar las aplicaciones de Microsoft Store, se requiere intervención manual"
|
||||
fr: "Impossible de mettre à jour les applications du Microsoft Store, une intervention manuelle est nécessaire"
|
||||
zh_CN: "无法更新 Microsoft Store 应用,需手动干预"
|
||||
zh_TW: "無法更新 Microsoft Store 應用,需手動幹預"
|
||||
de: "Microsoft Store-Apps können nicht aktualisiert werden, manuelles Eingreifen erforderlich"
|
||||
"No JetBrains Toolbox installation found":
|
||||
en: "No JetBrains Toolbox installation found"
|
||||
lt: "Nerasta JetBrains Toolbox įdiegimo"
|
||||
|
||||
@@ -230,8 +230,6 @@ pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
print_separator(t!("Windows Update"));
|
||||
|
||||
if powershell.supports_windows_update() {
|
||||
println!("The installer will request to run as administrator, expect a prompt.");
|
||||
|
||||
powershell.windows_update(ctx)
|
||||
} else {
|
||||
print_warning(t!(
|
||||
|
||||
@@ -216,11 +216,27 @@ impl Powershell {
|
||||
|
||||
pub fn microsoft_store(&self, ctx: &ExecutionContext) -> Result<()> {
|
||||
println!("{}", t!("Scanning for updates..."));
|
||||
let cmd = "Start-Process powershell -Verb RunAs -ArgumentList '-Command', \
|
||||
'(Get-CimInstance -Namespace \"Root\\cimv2\\mdm\\dmmap\" \
|
||||
-ClassName \"MDM_EnterpriseModernAppManagement_AppManagement01\" | \
|
||||
Invoke-CimMethod -MethodName UpdateScanMethod).ReturnValue'";
|
||||
|
||||
self.build_command(ctx, cmd, true)?.status_checked()
|
||||
// Scan for updates using the MDM UpdateScanMethod
|
||||
// This method is also available for non-MDM devices
|
||||
let cmd = r#"(Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod).ReturnValue"#;
|
||||
|
||||
self.build_command(ctx, cmd, true)?.output_checked_with_utf8(|output| {
|
||||
if !output.status.success() {
|
||||
return Err(());
|
||||
}
|
||||
let ret_val = output.stdout.trim();
|
||||
debug!("Command return value: {}", ret_val);
|
||||
if ret_val == "0" {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
})?;
|
||||
println!(
|
||||
"{}",
|
||||
t!("Success, Microsoft Store apps are being updated in the background")
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user