mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-15 20:44:17 +01:00
31 lines
759 B
PowerShell
Executable File
31 lines
759 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
Determines the exact OS version
|
|
.DESCRIPTION
|
|
This script determines and says the exact operating system version by text-to-speech (TTS).
|
|
.EXAMPLE
|
|
PS> ./check-operating-system
|
|
.NOTES
|
|
Author: Markus Fleschutz · License: CC0
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
#>
|
|
|
|
try {
|
|
if ($IsLinux) {
|
|
$Reply = (uname -sr)
|
|
} else {
|
|
$OS = Get-WmiObject -class Win32_OperatingSystem
|
|
$OSname = $OS.Caption
|
|
$OSarchitecture = $OS.OSArchitecture
|
|
$OSversion = $OS.Version
|
|
$Reply = "$OSname for $OSarchitecture version $OSversion"
|
|
}
|
|
"✔️ $Reply"
|
|
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
|
exit 1
|
|
}
|