ps/Modules/Cole.PowerShell.Developer/Public/Restore-AllProviders.ps1
2023-05-30 22:51:22 -07:00

22 lines
822 B
PowerShell

function Restore-AllProviders {
<#
.SYNOPSIS
This will reinstall all the providers found locally in the chocolatey folder.
This does not upgrade the providers.
#>
[CmdletBinding()]
[OutputType([void])]
param (
)
$logLead = (Get-LogLeadName)
$allPackages = (Get-AllInstalledComponentsByType -ComponentType Provider)
Write-Host "$logLead : Found the following packages to install"
$allPackages | Format-Table @{Name = "Package Name"; Width = 40; Expression={$_.PackageName}},@{Name = "Manifest Path"; Expression={$_.ManifestPath}}
$installerPath = (Get-ComponentInstallerInstallPath -ComponentType Provider)
Invoke-Parallel2 -Objects @($allPackages.ManifestPath) -Arguments @($installerPath) -Script { param($manifestPath,$installerPath) & $installerPath $manifestPath}
}