PowerShell/Scripts/check-iss-position.ps1

23 lines
753 B
PowerShell
Raw Normal View History

2021-12-04 17:51:31 +01:00
<#
.SYNOPSIS
2021-12-08 17:01:19 +01:00
Checks the ISS position
2021-12-04 17:51:31 +01:00
.DESCRIPTION
2021-12-08 17:01:19 +01:00
This script queries the position of the International Space Station (ISS) and replies by text-to-speech (TTS).
2021-12-04 17:51:31 +01:00
.EXAMPLE
2021-12-08 17:01:19 +01:00
PS> ./check-iss-position
2021-12-04 17:51:31 +01:00
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz · License: CC0
#>
try {
$ISS = (Invoke-WebRequest "http://api.open-notify.org/iss-now.json" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
2021-12-08 13:20:36 +01:00
& "$PSScriptRoot/give-reply.ps1" "The International Space Station is currently at $($ISS.iss_position.longitude)° longitude and $($ISS.iss_position.latitude)° latitude."
2021-12-04 17:51:31 +01:00
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}