diff --git a/.gitignore b/.gitignore
index 215d85ed..4d77e17c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,4 @@ Microsoft.PowerShell.ConsoleHost.dll
microwin.log
True
test.ps1
+winutil.ps1
diff --git a/config/applications.json b/config/applications.json
index 39fe433f..b9b16943 100644
--- a/config/applications.json
+++ b/config/applications.json
@@ -1687,6 +1687,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",
diff --git a/functions/private/Install-WinUtilProgramWinget.ps1 b/functions/private/Install-WinUtilProgramWinget.ps1
index 4f840007..2aa10bae 100644
--- a/functions/private/Install-WinUtilProgramWinget.ps1
+++ b/functions/private/Install-WinUtilProgramWinget.ps1
@@ -34,26 +34,40 @@ 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){
- 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){
- 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 {
- Write-Host "$Program installed successfully with Unelevated prompt."
- }
- } else {
- Write-Host "$Program installed successfully with User scope."
- }
- } else {
+ if($status -eq 0){
Write-Host "$Program installed successfully."
+ continue
}
- } catch {
+ 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 -eq 0){
+ Write-Host "$Program installed successfully with User scope."
+ continue
+ }
+ 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"
+ $status = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
+ if($status -eq 0){
+ Write-Host "$Program installed successfully using Chocolatey."
+ continue
+ }
+ Write-Host "Failed to install $Program. You need to install it manually... Sorry!"
+ } catch {
Write-Host "Failed to install $Program due to an error: $_"
- }
+ }
}
if($manage -eq "Uninstalling"){
# Uninstall package via ID using winget directly.
diff --git a/winutil.ps1 b/winutil.ps1
index 9650d9b4..f225bbfe 100644
--- a/winutil.ps1
+++ b/winutil.ps1
@@ -10,7 +10,7 @@
Author : Chris Titus @christitustech
Runspace Author: @DeveloperDurp
GitHub : https://github.com/ChrisTitusTech
- 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.05.09"
+$sync.version = "24.05.10"
$sync.configs = @{}
$sync.ProcessRunning = $false
@@ -733,26 +733,40 @@ 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){
- 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){
- 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 {
- Write-Host "$Program installed successfully with Unelevated prompt."
- }
- } else {
- Write-Host "$Program installed successfully with User scope."
- }
- } else {
+ if($status -eq 0){
Write-Host "$Program installed successfully."
+ continue
}
- } catch {
+ 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 -eq 0){
+ Write-Host "$Program installed successfully with User scope."
+ continue
+ }
+ 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"
+ $status = $(Start-Process -FilePath "choco" -ArgumentList "install $Program -y" -Wait -PassThru).ExitCode
+ if($status -eq 0){
+ Write-Host "$Program installed successfully using Chocolatey."
+ continue
+ }
+ Write-Host "Failed to install $Program. You need to install it manually... Sorry!"
+ } catch {
Write-Host "Failed to install $Program due to an error: $_"
- }
+ }
}
if($manage -eq "Uninstalling"){
# Uninstall package via ID using winget directly.
@@ -6709,6 +6723,14 @@ $sync.configs.applications = '{
"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",
@@ -12208,6 +12230,9 @@ $inputXML = '
+
+
+
@@ -12219,6 +12244,10 @@ $inputXML = '
+
+
+
+
@@ -12439,6 +12468,7 @@ $inputXML = '
+
@@ -12446,11 +12476,20 @@ $inputXML = '
+
+
+
+
+
+
+
+
+
diff --git a/xaml/inputApp.xaml b/xaml/inputApp.xaml
index fa8036be..839f4448 100644
--- a/xaml/inputApp.xaml
+++ b/xaml/inputApp.xaml
@@ -604,6 +604,9 @@
+
+
+
@@ -619,6 +622,9 @@
+
+
+
@@ -847,6 +853,12 @@
+
+
+
+
+
+