Samples/ImportCallhomeDetails/InFile/countries.ps1
# ------------------------------------------------------------------ # Lenovo Copyright # # (C) Copyright Lenovo 2024 - present. # # LIMITED AND RESTRICTED RIGHTS NOTICE: # If data or software is delivered pursuant a General Services # Administration (GSA) contract, use, reproduction, or disclosure # is subject to restrictions set forth in Contract No. GS-35F-05925. # ------------------------------------------------------------------ function GetCountriesList() { $content = Get-Content -path $PSScriptRoot\config\countries.json -Raw $json = ConvertFrom-Json -InputObject $content return $json } function GetCountryName() { param ( [Parameter(Mandatory = $true)] [string] $Abreviation, [Parameter(Mandatory = $true)] $CountiesList ) $result = "" $a = $CountiesList | Where-Object {$_.abbreviation -ieq $Abreviation} if ($null -ne $a) { $result = $a.name } return $result } function GetCountryAbreviation() { param ( [Parameter(Mandatory = $true)] [string] $Name, [Parameter(Mandatory = $true)] $CountiesList ) $result = "" $a = $CountiesList | Where-Object {$_.name -ieq $Name} if ($null -ne $a) { $result = $a.abbreviation } return $result } |