Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Fix Microsoft Store (fix #656)
Browse files Browse the repository at this point in the history
Despite the fact that Topgrade explicitly tries to run the Windows Powershell, gsudo has an odd behaviour which causes it to detect whether it's being run from Powershell for Cmd.
If run from Powershell, It will launch the current powershell with the given command. If the current shell is Powershell, it will try to run the command with it.
However, Get-WmiObject doesn't exist on Powershell core.
  • Loading branch information
r-darwish committed Feb 25, 2021
1 parent 0967329 commit 23d9a5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/steps/os/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn upgrade_store_apps(ctx: &ExecutionContext) -> Result<()> {
print_separator("Microsoft Store");
println!("Updating Microsoft Store applications in the background");

ctx.run_type().execute(sudo).arg(path).args(&["-NoProfile", "-Command", "(Get-WmiObject -Namespace 'root\\cimv2\\mdm\\dmmap' -Class 'MDM_EnterpriseModernAppManagement_AppManagement01').UpdateScanMethod() > $null"]).check_run()
ctx.run_type().execute("cmd").arg("/c").args(&[sudo, path]).args(&["-NoProfile", "-Command", "(Get-WmiObject -Namespace 'root\\cimv2\\mdm\\dmmap' -Class 'MDM_EnterpriseModernAppManagement_AppManagement01').UpdateScanMethod() > $null"]).check_run()
}

pub fn reboot() {
Expand Down

0 comments on commit 23d9a5b

Please sign in to comment.