function Get-CurrentSFIK { <# .SYNOPSIS Retrieves current Solor Flux Index and K Index information in JSON format from NOAA. It then returns the two most current variables (SFI first and K-Index second). .EXAMPLE $SFI, $K_INDEX = Get-CurrentSFIK .NOTES https://www.arrl.org/files/file/Technology/tis/info/pdf/0209038.pdf #> try { $flux = Invoke-RestMethod -Uri "https://services.swpc.noaa.gov/json/f107_cm_flux.json" $kindex = Invoke-RestMethod -Uri "https://services.swpc.noaa.gov/json/boulder_k_index_1m.json" } catch { $PSCmdlet.ThrowTerminatingError($_) } Return [int]$flux.flux[0], [int]$kindex.k_index[0] } $sfi, $kindex = Get-CurrentSFIK Write-Host "Current SFI: $sfi`nCurrent K Index: $kindex" if ( ($sfi -gt 149) -and ($kindex -lt 3) ) { Write-Host -ForegroundColor Yellow "Good HF Propagation Conditions!" } elseif ( ($sfi -gt 199) -and ($kindex -lt 3) ) { Write-Host -ForegroundColor Green "Excellent HF Propagation Conditions!" } Exit(0)