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/",
|
"link": "https://bitsum.com/",
|
||||||
"winget": "BitSum.ProcessLasso"
|
"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": {
|
"WPFInstallprocessmonitor": {
|
||||||
"category": "Microsoft Tools",
|
"category": "Microsoft Tools",
|
||||||
"choco": "procexp",
|
"choco": "procexp",
|
||||||
|
@ -44,21 +44,27 @@ Function Install-WinUtilProgramWinget {
|
|||||||
Write-Host "$Program installed successfully with User scope."
|
Write-Host "$Program installed successfully with User scope."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
Write-Host "Attempt with Unelevated prompt"
|
Write-Host "Attempt with User 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
|
$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($process.ExitCode -eq 0){
|
if ($userChoice -eq 'Yes') {
|
||||||
Write-Host "$Program installed successfully with Unelevated prompt."
|
$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
|
continue
|
||||||
}
|
}
|
||||||
Write-Host "Attempting installation with Chocolatey as a fallback method"
|
Write-Host "Attempting installation with Chocolatey as a fallback method"
|
||||||
$chocoStatus = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
|
$status = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
|
||||||
if($chocoStatus -eq 0){
|
if($status -eq 0){
|
||||||
Write-Host "$Program installed successfully using Chocolatey."
|
Write-Host "$Program installed successfully using Chocolatey."
|
||||||
continue
|
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 {
|
} catch {
|
||||||
Write-Host "Failed to install $Program due to an error: $_"
|
Write-Host "Failed to install $Program due to an error: $_"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user