commit for removal of user scope progs and user scope winget (#3727)

This commit is contained in:
Chris Titus
2025-11-17 13:10:44 -06:00
committed by GitHub
parent aedaa2f789
commit e0237642c8
2 changed files with 2 additions and 44 deletions

View File

@@ -1728,14 +1728,6 @@
"link": "https://proton.me/authenticator", "link": "https://proton.me/authenticator",
"winget": "Proton.ProtonAuthenticator" "winget": "Proton.ProtonAuthenticator"
}, },
"spotify": {
"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"
},
"processmonitor": { "processmonitor": {
"category": "Microsoft Tools", "category": "Microsoft Tools",
"choco": "procexp", "choco": "procexp",

View File

@@ -30,24 +30,16 @@ Function Install-WinUtilProgramWinget {
.PARAMETER wingetId .PARAMETER wingetId
The Id of the Program that Winget should Install/Uninstall The Id of the Program that Winget should Install/Uninstall
.PARAMETER scope
Determines the installation mode. Can be "user" or "machine" (For more info look at the winget documentation)
.PARAMETER credential
The PSCredential Object of the user that should be used to run winget
.NOTES .NOTES
Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed
#> #>
param ( param (
[string]$wingetId, [string]$wingetId
[string]$scope = "",
[PScredential]$credential = $null
) )
$commonArguments = "--id $wingetId --silent" $commonArguments = "--id $wingetId --silent"
$arguments = if ($Action -eq "Install") { $arguments = if ($Action -eq "Install") {
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})" "install $commonArguments --accept-source-agreements --accept-package-agreements"
} else { } else {
"uninstall $commonArguments" "uninstall $commonArguments"
} }
@@ -60,10 +52,6 @@ Function Install-WinUtilProgramWinget {
NoNewWindow = $true NoNewWindow = $true
} }
if ($credential) {
$processParams.credential = $credential
}
return (Start-Process @processParams).ExitCode return (Start-Process @processParams).ExitCode
} }
@@ -87,28 +75,6 @@ Function Install-WinUtilProgramWinget {
return $true return $true
} }
Write-Host "Attempt installation of $($Program) with User scope"
$status = Invoke-Winget -wingetId $Program -scope "user"
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User scope."
return $true
} elseif ($status -eq -1978335189) {
Write-Host "$($Program) No applicable update found"
return $true
}
$userAcknowledgment = [System.Windows.MessageBox]::Show("You need to input your password to install $($Program) with specific user credentials.", "User credential Prompt", [System.Windows.MessageBoxButton]::Ok)
if ($userAcknowledgment -eq 'Ok') {
$getcreds = Get-Credential $env:USERNAME
$status = Invoke-Winget -wingetId $Program -credential $getcreds
if ($status -eq 0) {
Write-Host "$($Program) installed successfully with User prompt."
return $true
}
} else {
Write-Host "Skipping installation with specific user credentials."
}
Write-Host "Failed to install $($Program)." Write-Host "Failed to install $($Program)."
return $false return $false
} }