Fix Microsoft Store (fix #656)

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.
This commit is contained in:
Roey Darwish Dror
2021-02-25 10:10:57 +02:00
parent 09673297db
commit 23d9a5bf63

View File

@@ -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() {