functions/Get-ChocoSourcePackages.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

 function Get-ChocoSourcePackages {
<#
 .SYNOPSIS
     Outputs all package names for one or multiple Chocolatey sources.
 .EXAMPLE
     Get-ChocoSourcePackages -Sources repo1,repo2
 #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string[]]$Sources
    )
    $Sources | ForEach-Object {
       choco list --source=$_ -r | ForEach-Object {$_.split("|")[0]}
    } | Sort-Object -Unique
}