Public/Get-LSCentralAppInfo.ps1
function Get-LSCentralAppInfo { param ( [String] $Version = '', [ValidateSet('eq', 'ge', 'gt')] [String] $VersionFilterType = 'eq', [ValidateSet('w1','at','au','be','ch','cz','de','dk','es','fi','fr','gb','is','it','na','nl','no','nz','ru','se')] [String] $Country = 'w1', [switch] $DefaultVersion, $VersionsJson ) if ($null -eq $VersionsJson) { $versionsJsonPath = Join-Path $PSScriptRoot "../Data/ls_central_versions.json" $VersionsJson = Get-Content $versionsJsonPath | ConvertFrom-Json } $filterArray = @() if ($version -ne "" -and $country -ne "") { switch ($versionFilterType) { "eq" { $filterArray += '$_.version -eq $Version -and $_.country -eq $country' } "ge" { $filterArray += '$_.version -ge $Version -and $_.country -eq $country' } "gt" { $filterArray += '$_.version -gt $Version -and $_.country -eq $country' } } } elseif ($version -eq "" -and $Country -ne "") { $filterArray += '$_.country -eq $Country' } if ($DefaultVersion.IsPresent) { $filterArray += '$_.default -eq $true' } $filterString = $filterArray -Join " -and " $filterScript = [scriptblock]::Create($filterString) $app = $VersionsJson.versions | Where-Object -FilterScript $filterScript Write-Output $app } Export-ModuleMember -Function Get-LSCentralAppInfo |