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`
----------------------
* 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
@ -113,8 +113,6 @@ Computer, check `name`
* *Computer, locate my phone.*
* *Computer, tell joke.*
* *Computer, tell quote.*
* *Computer, tell operating system.*
* *Computer, tell up-time.*
💬 Nice Conversation

View File

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

View File

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

View File

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