Functions/Set-ChocoPinList.ps1
function Set-ChocoPinList { [CmdletBinding()] param ( # [Parameter(Mandatory)] [ValidateSet("Appels", "Peren")] [string] $ParameterName ) $ChocoPinListFile = "$($env:OneDrive)\Backup\ChocoPinList.json" if (Test-Path $ChocoPinListFile) { $ChocoPinListImport = Get-Content $ChocoPinListFile | ConvertFrom-Json # $ChocoPinListImport } $ChocoPinList = choco pin list --limit-output $Output = @() $Output += $ChocoPinListImport $ChocoPinList | ForEach-Object { $app = ($_).split('|')[0] if ($ChocoPinListImport -notcontains $app) { $Output += $app } } $Output | ConvertTo-Json | Out-File $ChocoPinListFile $Output | ForEach-Object { choco pin add --name=`'$_`' | Out-Null } } |