waffle.lord b6f883ec38 update updater
using download file async since a hash isn't needed and also remove new installer from cache when done updating
2023-09-21 10:55:25 -04:00

30 lines
661 B
PowerShell

param(
[string]$source,
[string]$destination
)
clear
Write-Host "Stopping installer ..."
$installer = Stop-Process -Name "SPTInstaller" -ErrorAction SilentlyContinue
if ($installer -ne $null) {
Write-Host "Something went wrong, couldn't stop installer process'"
return;
}
Write-Host "Copying new installer ..."
Import-Module BitsTransfer
Start-BitsTransfer -Source $source -Destination $destination -DisplayName "Updating" -Description "Copying new installer"
Remove-Module -Name BitsTransfer
# remove the new installer from the cache folder after it is copied
Remove-Item -Path $source
Start-Process $destination
Write-Host "Done"