Skip to content

Commit

Permalink
Merge pull request #513 from Romanitho/reinstall
Browse files Browse the repository at this point in the history
Use admin right for app install by default
  • Loading branch information
Romanitho authored Dec 7, 2023
2 parents b195fda + edc3051 commit 59c39af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Gui.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ function Start-Installations {
if ($AppToInstall) {
Start-PopUp "Installing applications..."
$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
}
}


Expand Down Expand Up @@ -775,7 +782,7 @@ Start-PopUp "Starting..."
Get-WAUConfiguratorLatestVersion

#Check if Winget is installed, and install if not
Update-WinGet
$null = Update-WinGet

#Get WinGet cmd
$Script:Winget = Get-WingetCmd
Expand Down
2 changes: 1 addition & 1 deletion Winget-AutoUpdate/functions/Invoke-PostUpdateActions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Invoke-PostUpdateActions {
}

#Update Winget if not up to date
Update-WinGet
$null = Update-WinGet

#Create WAU Regkey if not present
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
Expand Down

0 comments on commit 59c39af

Please sign in to comment.