Public/Find-NevergreenApp.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
function Find-NevergreenApp { <# .SYNOPSIS Returns a list of all apps currently supported by Nevergreen. .DESCRIPTION Retrieves a list of supported applications by querying Get-*.ps1 under the Apps folder. .NOTES Site: https://packageology.com Author: Dan Gough Twitter: @packageologist .LINK https://github.com/DanGough/Nevergreen .PARAMETER Name The application name to return details for. Uses a RegEx match so will return all apps where the name contains the supplied string. Accepts an array for multiple matches, or can also accept values from the pipeline. .EXAMPLE Find-NevergreenApp Description: Returns a list of all currently supported applications. .EXAMPLE Find-NevergreenApp -Name 'Microsoft' Description: Returns a list of all currently supported applications with 'Microsoft' in the name. .EXAMPLE Find-NevergreenApp -Name 'Adobe','Microsoft' Description: Returns a list of all currently supported applications matching 'Adobe' or 'Microsoft'. #> [CmdletBinding(SupportsShouldProcess = $False)] param ( [Parameter( Mandatory = $false, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)] [System.String[]] $Name = '' ) begin { $AppDir = [System.IO.Path]::Combine((Split-Path -Path $PSScriptRoot -Parent), 'Apps') $Apps = (Get-ChildItem -Path $AppDir).BaseName | ForEach-Object { $_.Split('-')[1] } $Results = @() } process { foreach ($AppName in $Name) { $Results += $Apps | Where-Object { $_ -match $AppName } } } end { $Results | Select-Object -Unique } } |