re-run install if 32bit process on 64bit OS
parent
d5c9d0df4f
commit
50d8027bc9
|
@ -105,12 +105,12 @@ $WAUVersion = "1.15.3"
|
||||||
function Install-Prerequisites {
|
function Install-Prerequisites {
|
||||||
|
|
||||||
Write-Host "`nChecking prerequisites..." -ForegroundColor Yellow
|
Write-Host "`nChecking prerequisites..." -ForegroundColor Yellow
|
||||||
|
|
||||||
#Check if Visual C++ 2019 or 2022 installed
|
#Check if Visual C++ 2019 or 2022 installed
|
||||||
$Visual2019 = "Microsoft Visual C++ 2015-2019 Redistributable*"
|
$Visual2019 = "Microsoft Visual C++ 2015-2019 Redistributable*"
|
||||||
$Visual2022 = "Microsoft Visual C++ 2015-2022 Redistributable*"
|
$Visual2022 = "Microsoft Visual C++ 2015-2022 Redistributable*"
|
||||||
$path = Get-Item HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.GetValue("DisplayName") -like $Visual2019 -or $_.GetValue("DisplayName") -like $Visual2022 }
|
$path = Get-Item HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.GetValue("DisplayName") -like $Visual2019 -or $_.GetValue("DisplayName") -like $Visual2022 }
|
||||||
|
|
||||||
#If not installed, ask for installation
|
#If not installed, ask for installation
|
||||||
if (!($path)) {
|
if (!($path)) {
|
||||||
#If -silent option, force installation
|
#If -silent option, force installation
|
||||||
|
@ -173,7 +173,7 @@ function Install-WinGet {
|
||||||
If ([Version]$TestWinGet.Version -ge "2022.728.1939.0") {
|
If ([Version]$TestWinGet.Version -ge "2022.728.1939.0") {
|
||||||
|
|
||||||
Write-Host "WinGet is Installed" -ForegroundColor Green
|
Write-Host "WinGet is Installed" -ForegroundColor Green
|
||||||
|
|
||||||
}
|
}
|
||||||
Else {
|
Else {
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ function Install-WinGet {
|
||||||
catch {
|
catch {
|
||||||
Write-Host "Failed to intall Winget MSIXBundle for App Installer..." -ForegroundColor Red
|
Write-Host "Failed to intall Winget MSIXBundle for App Installer..." -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|
||||||
#Remove WinGet MSIXBundle
|
#Remove WinGet MSIXBundle
|
||||||
Remove-Item -Path "$PSScriptRoot\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force -ErrorAction Continue
|
Remove-Item -Path "$PSScriptRoot\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Force -ErrorAction Continue
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ function Install-WingetAutoUpdate {
|
||||||
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
|
$task = New-ScheduledTask -Action $taskAction -Principal $taskUserPrincipal -Settings $taskSettings
|
||||||
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -InputObject $task -Force | Out-Null
|
Register-ScheduledTask -TaskName 'Winget-AutoUpdate-UserContext' -InputObject $task -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Settings for the scheduled task for Notifications
|
# Settings for the scheduled task for Notifications
|
||||||
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WingetUpdatePath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WingetUpdatePath)\winget-notify.ps1`"`""
|
$taskAction = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "`"$($WingetUpdatePath)\Invisible.vbs`" `"powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"`"`"$($WingetUpdatePath)\winget-notify.ps1`"`""
|
||||||
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
|
$taskUserPrincipal = New-ScheduledTaskPrincipal -GroupId S-1-5-11
|
||||||
|
@ -372,7 +372,7 @@ function Install-WingetAutoUpdate {
|
||||||
|
|
||||||
Write-host "WAU Installation succeeded!" -ForegroundColor Green
|
Write-host "WAU Installation succeeded!" -ForegroundColor Green
|
||||||
Start-sleep 1
|
Start-sleep 1
|
||||||
|
|
||||||
#Run Winget ?
|
#Run Winget ?
|
||||||
Start-WingetAutoUpdate
|
Start-WingetAutoUpdate
|
||||||
}
|
}
|
||||||
|
@ -384,13 +384,13 @@ function Install-WingetAutoUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Uninstall-WingetAutoUpdate {
|
function Uninstall-WingetAutoUpdate {
|
||||||
|
|
||||||
Write-Host "`nUninstalling WAU..." -ForegroundColor Yellow
|
Write-Host "`nUninstalling WAU..." -ForegroundColor Yellow
|
||||||
|
|
||||||
try {
|
try {
|
||||||
#Get registry install location
|
#Get registry install location
|
||||||
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
||||||
|
|
||||||
#Check if installed location exists and delete
|
#Check if installed location exists and delete
|
||||||
if (Test-Path ($InstallLocation)) {
|
if (Test-Path ($InstallLocation)) {
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ function Uninstall-WingetAutoUpdate {
|
||||||
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
||||||
& reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null
|
& reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null
|
||||||
& reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
|
& reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
|
||||||
|
|
||||||
if ((Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
|
if ((Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
|
||||||
Remove-Item -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" -Recurse -Force | Out-Null
|
Remove-Item -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" -Recurse -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
@ -478,6 +478,14 @@ function Add-Shortcut ($Target, $Shortcut, $Arguments, $Icon, $Description) {
|
||||||
|
|
||||||
<# MAIN #>
|
<# MAIN #>
|
||||||
|
|
||||||
|
#If running as a 32-bit process on an x64 system, re-launch as a 64-bit process
|
||||||
|
if ("$env:PROCESSOR_ARCHITEW6432" -ne "ARM64") {
|
||||||
|
if (Test-Path "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe") {
|
||||||
|
Start-Process "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe" -Wait -NoNewWindow -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command $($MyInvocation.line)"
|
||||||
|
Exit $lastexitcode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "`n"
|
Write-Host "`n"
|
||||||
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
|
Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta
|
||||||
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
|
Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta
|
||||||
|
|
Loading…
Reference in New Issue