mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-29 08:06:51 +01:00
Update check-drives.ps1, check-smart-devices.ps1, and
list-earthquakes.ps1
This commit is contained in:
parent
f69519c603
commit
fbd44c0c28
@ -33,6 +33,7 @@ function Bytes2String { param([int64]$Bytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Write-Progress "⏳ Querying drives..."
|
||||||
$Drives = Get-PSDrive -PSProvider FileSystem
|
$Drives = Get-PSDrive -PSProvider FileSystem
|
||||||
foreach($Drive in $Drives) {
|
foreach($Drive in $Drives) {
|
||||||
$ID = $Drive.Name
|
$ID = $Drive.Name
|
||||||
@ -53,6 +54,7 @@ try {
|
|||||||
Write-Host "✅ Drive $ID has $(Bytes2String $Free) of $(Bytes2String $Total) free"
|
Write-Host "✅ Drive $ID has $(Bytes2String $Free) of $(Bytes2String $Total) free"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Write-Progress -completed "Querying drives finished."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -39,8 +39,9 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
$Devices = $(smartctl --scan-open)
|
$Devices = $(smartctl --scan-open)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Write-Progress "⏳ Querying S.M.A.R.T devices..."
|
||||||
foreach($Device in $Devices) {
|
foreach($Device in $Devices) {
|
||||||
Write-Progress "⏳ Querying S.M.A.R.T devices..."
|
|
||||||
$Array = $Device.split(" ")
|
$Array = $Device.split(" ")
|
||||||
$Device = $Array[0]
|
$Device = $Array[0]
|
||||||
if ("$Device" -eq "#") {
|
if ("$Device" -eq "#") {
|
||||||
@ -67,7 +68,7 @@ try {
|
|||||||
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
|
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
|
||||||
Write-Host "✅ $($Capacity)$ModelName via $Protocol ($Hours hours, $($PowerOn)x on, v$($Firmware), $($Temp)°C, selftest $Status)"
|
Write-Host "✅ $($Capacity)$ModelName via $Protocol ($Hours hours, $($PowerOn)x on, v$($Firmware), $($Temp)°C, selftest $Status)"
|
||||||
}
|
}
|
||||||
Write-Progress -Completed " "
|
Write-Progress -completed "Querying S.M.A.R.T devices finished."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
$Format="csv" # cap, csv, geojson, kml, kmlraw, quakeml, text, xml
|
$Format="csv" # cap, csv, geojson, kml, kmlraw, quakeml, text, xml
|
||||||
$MinMagnitude=5.8
|
$MinMagnitude=5.7
|
||||||
$OrderBy="magnitude" # time, time-asc, magnitude, magnitude-asc
|
$OrderBy="magnitude" # time, time-asc, magnitude, magnitude-asc
|
||||||
|
|
||||||
function ListEarthquakes {
|
function ListEarthquakes {
|
||||||
@ -22,6 +22,7 @@ function ListEarthquakes {
|
|||||||
[int]$Depth = $Quake.depth
|
[int]$Depth = $Quake.depth
|
||||||
New-Object PSObject -Property @{ Mag=$Quake.mag; Depth="$Depth km"; Location=$Quake.place; Time=$Quake.time }
|
New-Object PSObject -Property @{ Mag=$Quake.mag; Depth="$Depth km"; Location=$Quake.place; Time=$Quake.time }
|
||||||
}
|
}
|
||||||
|
Write-Progress -completed "Loading finished."
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user