Private/Update-ServiceCache.ps1
function Update-ServiceCache { param ( ) if (-not $Script:CachedService) { try { Write-Progress -Activity 'Updating service cache' -CurrentOperation 'Downloading' $Script:CachedService = Invoke-WebRequest -Uri https://www.ah.nl/service/obtainment/rest/stores/services } catch { throw 'Could not update cached service information. Make sure http://ah.nl is reachable.' } Write-Progress -Activity 'Updating service cache' -CurrentOperation 'Parsing' $Script:CachedService = $Script:CachedService | ConvertFrom-Json } } |