PowerShell/Scripts/check-iss-position.ps1

23 lines
740 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
2022-01-29 12:47:46 +01:00
This PowerShell 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
2022-09-06 21:42:04 +02:00
Author: Markus Fleschutz | License: CC0
2021-12-04 17:51:31 +01:00
#>
try {
$ISS = (Invoke-WebRequest "http://api.open-notify.org/iss-now.json" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
2022-11-18 16:54:04 +01:00
& "$PSScriptRoot/speak-english.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 {
2022-04-13 12:06:32 +02:00
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2021-12-04 17:51:31 +01:00
exit 1
}