Rename to check-operating-system.ps1 and check-uptime.ps1

This commit is contained in:
Markus Fleschutz 2021-12-01 11:01:53 +01:00
parent 17b2050c07
commit 372e773c12
4 changed files with 22 additions and 24 deletions

View File

@ -97,7 +97,7 @@ Computer, open `name` settings
Computer, check `name` Computer, check `name`
---------------------- ----------------------
* let the computer check something. * let the computer check something.
* replace `name` by: "CPU", "DNS", "ping", or "swap space" * replace `name` by: "CPU", "DNS", "operating system", "ping", "swap space", or "up-time".
🔊 Audio 🔊 Audio
@ -113,8 +113,6 @@ Computer, check `name`
* *Computer, locate my phone.* * *Computer, locate my phone.*
* *Computer, tell joke.* * *Computer, tell joke.*
* *Computer, tell quote.* * *Computer, tell quote.*
* *Computer, tell operating system.*
* *Computer, tell up-time.*
💬 Nice Conversation 💬 Nice Conversation

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the health of the local computer Checks the computer health
.DESCRIPTION .DESCRIPTION
This script checks the health of the local computer. This script checks the health of the local computer.
.EXAMPLE .EXAMPLE
@ -10,7 +10,6 @@
30.3 °C CPU temperature - good 30.3 °C CPU temperature - good
DNS resolution is 19.7 domains per second DNS resolution is 19.7 domains per second
29 ms ping average (13 ms min, 110 ms max, 10 hosts) 29 ms ping average (13 ms min, 110 ms max, 10 hosts)
Windmill is healthy
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -18,6 +17,8 @@
License: CC0 License: CC0
#> #>
& "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-operating-system.ps1"
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
if ($lastExitCode -ne "0") { $Healthy = 0 } if ($lastExitCode -ne "0") { $Healthy = 0 }

View File

@ -1,10 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Tells the OS version by text-to-speech Determines the exact OS version
.DESCRIPTION .DESCRIPTION
This script speaks the operating system version by text-to-speech (TTS). This script determines and says the exact operating system version by text-to-speech (TTS).
.EXAMPLE .EXAMPLE
PS> ./tell-operating-system PS> ./check-operating-system
.NOTES .NOTES
Author: Markus Fleschutz · License: CC0 Author: Markus Fleschutz · License: CC0
.LINK .LINK
@ -13,16 +13,16 @@
try { try {
if ($IsLinux) { if ($IsLinux) {
$Answer = (uname -sr) $Reply = (uname -sr)
} else { } else {
$OS = Get-WmiObject -class Win32_OperatingSystem $OS = Get-WmiObject -class Win32_OperatingSystem
$OSname = $OS.Caption $OSname = $OS.Caption
$OSarchitecture = $OS.OSArchitecture $OSarchitecture = $OS.OSArchitecture
$OSversion = $OS.Version $OSversion = $OS.Version
$Answer = "$OSname for $OSarchitecture version $OSversion" $Reply = "$OSname for $OSarchitecture version $OSversion"
} }
& "$PSScriptRoot/speak-english.ps1" "$Answer" "✔️ $Reply"
write-output "$Answer" & "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -1,10 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Tells the uptime by text-to-speech Determines the uptime
.DESCRIPTION .DESCRIPTION
This script speaks the uptime version by text-to-speech (TTS). This script determines and says the uptime by text-to-speech (TTS).
.EXAMPLE .EXAMPLE
PS> ./tell-uptime PS> ./check-uptime
.NOTES .NOTES
Author: Markus Fleschutz · License: CC0 Author: Markus Fleschutz · License: CC0
.LINK .LINK
@ -25,23 +25,22 @@ try {
$Minutes = $Uptime.Minutes $Minutes = $Uptime.Minutes
if ($Days -eq "1") { if ($Days -eq "1") {
$Answer = "I'm up for 1 day, " $Reply = "Up for 1 day, "
} else { } else {
$Answer = "I'm up for $Days days, " $Reply = "Up for $Days days, "
} }
if ($Hours -eq "1") { if ($Hours -eq "1") {
$Answer += "1 hour " $Reply += "1 hour "
} else { } else {
$Answer += "$Hours hours " $Reply += "$Hours hours "
} }
if ($Minutes -eq "1") { if ($Minutes -eq "1") {
$Answer += "and 1 minute." $Reply += "and 1 minute."
} else { } else {
$Answer += "and $Minutes minutes." $Reply += "and $Minutes minutes."
} }
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Answer" & "$PSScriptRoot/speak-english.ps1" "$Reply"
write-output "$Answer"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"