mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-05 04:33:53 -05:00
Add Spotify and Choco Fallback
This commit is contained in:
@ -1615,6 +1615,14 @@
|
||||
"link": "https://bitsum.com/",
|
||||
"winget": "BitSum.ProcessLasso"
|
||||
},
|
||||
"WPFInstallspotify": {
|
||||
"category": "Multimedia Tools",
|
||||
"choco": "spotify",
|
||||
"content": "Spotify",
|
||||
"description": "Spotify is a digital music service that gives you access to millions of songs, podcasts, and videos from artists all over the world.",
|
||||
"link": "https://www.spotify.com/",
|
||||
"winget": "Spotify.Spotify"
|
||||
},
|
||||
"WPFInstallprocessmonitor": {
|
||||
"category": "Microsoft Tools",
|
||||
"choco": "procexp",
|
||||
|
@ -44,21 +44,27 @@ Function Install-WinUtilProgramWinget {
|
||||
Write-Host "$Program installed successfully with User scope."
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempt with Unelevated prompt"
|
||||
$process = Start-Process -FilePath "powershell" -ArgumentList "-Command Start-Process winget -ArgumentList 'install --id $Program --silent --accept-source-agreements --accept-package-agreements' -Verb runAsUser" -Wait -PassThru
|
||||
if($process.ExitCode -eq 0){
|
||||
Write-Host "$Program installed successfully with Unelevated prompt."
|
||||
Write-Host "Attempt with User prompt"
|
||||
$userChoice = [System.Windows.MessageBox]::Show("Do you want to attempt $Program installation with specific user credentials? Select 'Yes' to proceed or 'No' to skip.", "User Credential Prompt", [System.Windows.MessageBoxButton]::YesNo)
|
||||
if ($userChoice -eq 'Yes') {
|
||||
$getcreds = Get-Credential
|
||||
$process = Start-Process -FilePath "winget" -ArgumentList "install --id $Program --silent --accept-source-agreements --accept-package-agreements" -Credential $getcreds -PassThru
|
||||
Wait-Process -Id $process.Id
|
||||
$status = $process.ExitCode
|
||||
} else {
|
||||
Write-Host "Skipping installation with specific user credentials."
|
||||
}
|
||||
if($status -eq 0){
|
||||
Write-Host "$Program installed successfully with User prompt."
|
||||
continue
|
||||
}
|
||||
Write-Host "Attempting installation with Chocolatey as a fallback method"
|
||||
$chocoStatus = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
|
||||
if($chocoStatus -eq 0){
|
||||
$status = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
|
||||
if($status -eq 0){
|
||||
Write-Host "$Program installed successfully using Chocolatey."
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to install $Program using Chocolatey."
|
||||
}
|
||||
Write-Host "Failed to install $Program."
|
||||
Write-Host "Failed to install $Program. You need to install it manually... Sorry!"
|
||||
} catch {
|
||||
Write-Host "Failed to install $Program due to an error: $_"
|
||||
}
|
||||
|
Reference in New Issue
Block a user