mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Update check-dns.ps1, check-drives.ps1, and check-smart-devices.ps1
This commit is contained in:
parent
357a6f2fbb
commit
3375e6db6e
@ -2,7 +2,7 @@
|
||||
.SYNOPSIS
|
||||
Checks the DNS resolution
|
||||
.DESCRIPTION
|
||||
This PowerShell script measures the DNS resolution speed by using 200 frequently used domain names.
|
||||
This PowerShell script measures and prints the DNS resolution speed by using 200 frequently used domain names.
|
||||
.EXAMPLE
|
||||
PS> ./check-dns
|
||||
.LINK
|
||||
@ -28,13 +28,13 @@ try {
|
||||
$Average = [math]::round($NumRows / $Elapsed, 1)
|
||||
|
||||
if ($Average -gt 200.0) {
|
||||
"✅ $Average DNS domain lookups per second - excellent"
|
||||
"✅ DNS resolves $Average domains per second - excellent"
|
||||
} elseif ($Average -gt 100.0) {
|
||||
"✅ $Average DNS domain lookups per second - quite good"
|
||||
"✅ DNS resolves $Average domains per second - quite good"
|
||||
} elseif ($Average -gt 10.0) {
|
||||
"✅ $Average DNS domain lookups per second - good"
|
||||
"✅ DNS resolves $Average domains per second - good"
|
||||
} else {
|
||||
"⚠️ $Average DNS domain lookups per second - poor"
|
||||
"⚠️ DNS resolves $Average domains per second - poor"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -3,6 +3,8 @@
|
||||
Checks the free space of all drives
|
||||
.DESCRIPTION
|
||||
This PowerShell script checks all drives for free space left (20 GB by default).
|
||||
.PARAMETER MinLevel
|
||||
Specifies the minimum warning level (10 GB by default)
|
||||
.EXAMPLE
|
||||
PS> ./check-drives
|
||||
.LINK
|
||||
@ -11,7 +13,7 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([int]$MinLevel = 50) # 50 GB minimum
|
||||
param([int]$MinLevel = 10) # 10 GB minimum
|
||||
|
||||
try {
|
||||
$Drives = Get-PSDrive -PSProvider FileSystem
|
||||
@ -22,16 +24,15 @@ try {
|
||||
[int]$Total = ($Used + $Free)
|
||||
|
||||
if ($Total -eq "0") {
|
||||
$Reply = "✅ Drive $($Drive.Name) is empty."
|
||||
"✅ Drive $($Drive.Name) is empty."
|
||||
} elseif ($Free -lt $MinLevel) {
|
||||
$Reply = "⚠️ Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use."
|
||||
"⚠️ Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use."
|
||||
} else {
|
||||
$Reply = "✅ Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
|
||||
"✅ Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total."
|
||||
}
|
||||
"$Reply"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
Specifies the type of selftest: either short (default) or long
|
||||
.EXAMPLE
|
||||
PS> ./check-smart-devices
|
||||
✔️ short selftest started on S.M.A.R.T. device /dev/sda
|
||||
✅ Started short selftest on S.M.A.R.T. device /dev/sda
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -28,7 +28,7 @@ try {
|
||||
$Array = $Device.split(" ")
|
||||
$Device = $Array[0]
|
||||
$Result = (sudo smartctl --test=$type $Device)
|
||||
"✔️ $type selftest started on S.M.A.R.T. device $Device"
|
||||
"✅ Started $type selftest on S.M.A.R.T. device $Device"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user