mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-05 12:43:50 -05:00
Compile Winutil
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
d7405d85c4
commit
ea60dac8dd
28
winutil.ps1
28
winutil.ps1
@ -10,7 +10,7 @@
|
||||
Author : Chris Titus @christitustech
|
||||
Runspace Author: @DeveloperDurp
|
||||
GitHub : https://github.com/ChrisTitusTech
|
||||
Version : 24.04.21
|
||||
Version : 24.05.09
|
||||
#>
|
||||
param (
|
||||
[switch]$Debug,
|
||||
@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
||||
# Variable to sync between runspaces
|
||||
$sync = [Hashtable]::Synchronized(@{})
|
||||
$sync.PSScriptRoot = $PSScriptRoot
|
||||
$sync.version = "24.04.21"
|
||||
$sync.version = "24.05.09"
|
||||
$sync.configs = @{}
|
||||
$sync.ProcessRunning = $false
|
||||
|
||||
@ -725,7 +725,7 @@ Function Install-WinUtilProgramWinget {
|
||||
|
||||
Foreach ($Program in $($ProgramsToInstall -split ",")){
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
Write-Progres -Activity "$manage Applications" -Status "$manage $Program $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
if($manage -eq "Installing"){
|
||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
||||
@ -733,23 +733,23 @@ Function Install-WinUtilProgramWinget {
|
||||
# This is up to the individual package maintainers to enable these options. Aka. not as clean as Linux Package Managers.
|
||||
try {
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $Program --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
if(status -eq 0){
|
||||
write-host "$program installed successfully."
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with User scope"
|
||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $Program --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
if(status -eq 0){
|
||||
Write-Host "$Program installed successfully with User scope."
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with Unelevated prompt"
|
||||
$status = $(Start-Process -FilePath "powershell" -ArgumentList "-Command Start-Process winget -ArgumentList 'install --id $Program --silent --accept-source-agreements --accept-package-agreements' -Verb runAsUser" -Wait -PassThru).ExitCode
|
||||
if($status -ne 0){
|
||||
Write-Host "Failed to install $Program."
|
||||
} else {
|
||||
if(status -eq 0){
|
||||
Write-Host "$Program installed successfully with Unelevated prompt."
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
Write-Host "$Program installed successfully with User scope."
|
||||
}
|
||||
} else {
|
||||
Write-Host "$Program installed successfully."
|
||||
}
|
||||
Write-Host "Failed to install $Program."
|
||||
} catch {
|
||||
Write-Host "Failed to install $Program due to an error: $_"
|
||||
}
|
||||
|
Reference in New Issue
Block a user