From d90fc5772e04a45b9c8ff2a9da92acbc379b1870 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 21 Sep 2024 02:14:47 +0200 Subject: [PATCH] Install the package provider for `PinnedItem` --- scripts/Windows/Software/PinnedItem/Manage.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/Windows/Software/PinnedItem/Manage.ps1 b/scripts/Windows/Software/PinnedItem/Manage.ps1 index 27187fa3..7631a130 100644 --- a/scripts/Windows/Software/PinnedItem/Manage.ps1 +++ b/scripts/Windows/Software/PinnedItem/Manage.ps1 @@ -20,7 +20,13 @@ Start-SoftwareInstaller @parameters -Installer { [hashtable] $Arguments ) + $providerName = "NuGet"; $module = $Arguments.Name; + + if ({ $null = powershell -c "Get-PackageProvider -ListAvailable $providerName"; $? }) { + $null = powershell -c "Install-PackageProvider -Force $providerName"; + } + & $Arguments.Installer @PSBoundParameters; if (-not (& { powershell -NoProfile -Command "Import-Module $module; exit ([bool]`$Error)" 2> $null; $?; })) {