CmdLets/Initialize-Library.ps1
|
Function Initialize-Library { [CmdletBinding()] Param( [Parameter(Mandatory=$True,ValueFromPipeline)] [System.IO.FileInfo[]]$Library, [Parameter(Mandatory=$False)] [Switch]$Append ) Begin { If (!$Append.IsPresent) { $Global:AppLibrary = @() } } Process { $Applications = $Library | Get-Content | ConvertFrom-JSON | Where-Object { $_.Name -NotIn $Global:AppLibrary.Name } $Global:AppLibrary += $Applications | ForEach-Object { $_ } } } |