Add check-powershell.ps1

This commit is contained in:
Markus Fleschutz 2022-12-01 09:50:58 +01:00
parent 546dbdfcaf
commit 0fe4d2f6c7
4 changed files with 27 additions and 4 deletions

View File

@ -47,7 +47,7 @@ try {
} elseif ($Used -lt $Free) {
"✅ Drive $ID uses $(Bytes2String $Used) of $(Bytes2String $Total)"
} else {
"✅ Drive $ID has $(Bytes2String $Free) of $(Bytes2String $Total) left to use"
"✅ Drive $ID has $(Bytes2String $Free) free of $(Bytes2String $Total)"
}
}
exit 0 # success

View File

@ -22,7 +22,8 @@
& "$PSScriptRoot/check-battery.ps1"
" "
& "$PSScriptRoot/write-green.ps1" " S O F T W A R E"
& "$PSScriptRoot/check-operating-system.ps1"
& "$PSScriptRoot/check-os.ps1"
& "$PSScriptRoot/check-powershell.ps1"
& "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-time-zone.ps1"
& "$PSScriptRoot/check-swap-space.ps1"

View File

@ -4,7 +4,7 @@
.DESCRIPTION
This PowerShell script queries and lists operating system details.
.EXAMPLE
PS> ./check-operating-system
PS> ./check-os
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -25,7 +25,7 @@ try {
$BuildNo = $OSDetails.BuildNumber
$Serial = $OSDetails.SerialNumber
$InstallDate = $OSDetails.InstallDate
"$($Name): $Arch, v$Version, S/N $Serial, installed $($InstallDate.ToShortDateString())"
"$($Name) ($Arch, v$Version, S/N $Serial, installed $($InstallDate.ToShortDateString()))"
}
exit 0 # success
} catch {

View File

@ -0,0 +1,22 @@
<#
.SYNOPSIS
Query PowerShell details
.DESCRIPTION
This PowerShell script queries and lists details of PowerShell.
.EXAMPLE
PS> ./check-powershell
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$Version = $PSVersionTable.PSVersion
$Edition = $PSVersionTable.PSEdition
"✅ PowerShell $Version ($Edition edition)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}