Improve MSI update from v1
parent
56fdc59509
commit
a64eda4ac7
|
@ -96,17 +96,26 @@ function Update-WAU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Stop ServiceUI
|
||||||
|
$ServiceUI = Get-Process -ProcessName serviceui -ErrorAction SilentlyContinue
|
||||||
|
if ($ServiceUI) {
|
||||||
|
try {
|
||||||
|
Write-ToLog "Stopping ServiceUI"
|
||||||
|
$ServiceUI | Stop-Process
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-ToLog "Failed to stop ServiceUI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Uninstall WAU v1
|
||||||
|
Write-ToLog "Uninstalling WAU v1"
|
||||||
|
Start-Process powershell -ArgumentList "-WindowStyle Hidden -ExecutionPolicy Bypass -Command `"$WorkingDir\WAU-Uninstall.ps1`"" -Wait
|
||||||
|
|
||||||
#Update WAU and run
|
#Update WAU and run
|
||||||
Write-ToLog "Updating WAU..." "Yellow"
|
Write-ToLog "Updating WAU..." "Yellow"
|
||||||
Start-Process msiexec.exe -ArgumentList "/i $MsiFile /qn /L*v ""$WorkingDir\logs\WAU-Installer.log"" RUN_WAU=YES"
|
Start-Process msiexec.exe -ArgumentList "/i $MsiFile /qn /L*v ""$WorkingDir\logs\WAU-Installer.log"" RUN_WAU=YES"
|
||||||
|
|
||||||
#Send success Notif
|
|
||||||
Write-ToLog "WAU Update completed. Rerunning WAU..." "Green"
|
|
||||||
$Title = $NotifLocale.local.outputs.output[3].title -f "Winget-AutoUpdate"
|
|
||||||
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
|
|
||||||
$MessageType = "success"
|
|
||||||
Start-NotifTask -Title $Title -Message $Message -MessageType $MessageType -Button1Action $OnClickAction -Button1Text $Button1Text
|
|
||||||
|
|
||||||
Exit 0
|
Exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue