Skip to content

Commit e023764

Browse files
commit for removal of user scope progs and user scope winget (#3727)
1 parent aedaa2f commit e023764

File tree

2 files changed

+2
-44
lines changed

2 files changed

+2
-44
lines changed

config/applications.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,14 +1728,6 @@
17281728
"link": "https://proton.me/authenticator",
17291729
"winget": "Proton.ProtonAuthenticator"
17301730
},
1731-
"spotify": {
1732-
"category": "Multimedia Tools",
1733-
"choco": "spotify",
1734-
"content": "Spotify",
1735-
"description": "Spotify is a digital music service that gives you access to millions of songs, podcasts, and videos from artists all over the world.",
1736-
"link": "https://www.spotify.com/",
1737-
"winget": "Spotify.Spotify"
1738-
},
17391731
"processmonitor": {
17401732
"category": "Microsoft Tools",
17411733
"choco": "procexp",

functions/private/Install-WinUtilProgramWinget.ps1

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,16 @@ Function Install-WinUtilProgramWinget {
3030
.PARAMETER wingetId
3131
The Id of the Program that Winget should Install/Uninstall
3232
33-
.PARAMETER scope
34-
Determines the installation mode. Can be "user" or "machine" (For more info look at the winget documentation)
35-
36-
.PARAMETER credential
37-
The PSCredential Object of the user that should be used to run winget
38-
3933
.NOTES
4034
Invoke Winget uses the public variable $Action defined outside the function to determine if a Program should be installed or removed
4135
#>
4236
param (
43-
[string]$wingetId,
44-
[string]$scope = "",
45-
[PScredential]$credential = $null
37+
[string]$wingetId
4638
)
4739

4840
$commonArguments = "--id $wingetId --silent"
4941
$arguments = if ($Action -eq "Install") {
50-
"install $commonArguments --accept-source-agreements --accept-package-agreements $(if ($scope) {" --scope $scope"})"
42+
"install $commonArguments --accept-source-agreements --accept-package-agreements"
5143
} else {
5244
"uninstall $commonArguments"
5345
}
@@ -60,10 +52,6 @@ Function Install-WinUtilProgramWinget {
6052
NoNewWindow = $true
6153
}
6254

63-
if ($credential) {
64-
$processParams.credential = $credential
65-
}
66-
6755
return (Start-Process @processParams).ExitCode
6856
}
6957

@@ -87,28 +75,6 @@ Function Install-WinUtilProgramWinget {
8775
return $true
8876
}
8977

90-
Write-Host "Attempt installation of $($Program) with User scope"
91-
$status = Invoke-Winget -wingetId $Program -scope "user"
92-
if ($status -eq 0) {
93-
Write-Host "$($Program) installed successfully with User scope."
94-
return $true
95-
} elseif ($status -eq -1978335189) {
96-
Write-Host "$($Program) No applicable update found"
97-
return $true
98-
}
99-
100-
$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)
101-
if ($userAcknowledgment -eq 'Ok') {
102-
$getcreds = Get-Credential $env:USERNAME
103-
$status = Invoke-Winget -wingetId $Program -credential $getcreds
104-
if ($status -eq 0) {
105-
Write-Host "$($Program) installed successfully with User prompt."
106-
return $true
107-
}
108-
} else {
109-
Write-Host "Skipping installation with specific user credentials."
110-
}
111-
11278
Write-Host "Failed to install $($Program)."
11379
return $false
11480
}

0 commit comments

Comments
 (0)