Merge pull request #513 from Romanitho/reinstall

Use admin right for app install by default
pull/515/head
Romain 2023-12-07 01:19:32 +01:00 committed by GitHub
commit 59c39afda9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

11
Gui.ps1
View File

@ -195,7 +195,14 @@ function Start-Installations {
if ($AppToInstall) { if ($AppToInstall) {
Start-PopUp "Installing applications..." Start-PopUp "Installing applications..."
$WAUInstallPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation $WAUInstallPath = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$WAUInstallPath\Winget-Install.ps1 -AppIDs $AppToInstall`"" -Wait #-Verb RunAs -> Removing admin rights for user context apps
#Try with admin rights.
try {
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$WAUInstallPath\Winget-Install.ps1 -AppIDs $AppToInstall`"" -Wait -Verb RunAs
}
catch {
Start-Process "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -Command `"$WAUInstallPath\Winget-Install.ps1 -AppIDs $AppToInstall`"" -Wait
}
} }
@ -775,7 +782,7 @@ Start-PopUp "Starting..."
Get-WAUConfiguratorLatestVersion Get-WAUConfiguratorLatestVersion
#Check if Winget is installed, and install if not #Check if Winget is installed, and install if not
Update-WinGet $null = Update-WinGet
#Get WinGet cmd #Get WinGet cmd
$Script:Winget = Get-WingetCmd $Script:Winget = Get-WingetCmd

View File

@ -18,7 +18,7 @@ function Invoke-PostUpdateActions {
} }
#Update Winget if not up to date #Update Winget if not up to date
Update-WinGet $null = Update-WinGet
#Create WAU Regkey if not present #Create WAU Regkey if not present
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" $regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"