mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 00:54:04 +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 {
|
||||
Write-Progress "⏳ Querying drives..."
|
||||
$Drives = Get-PSDrive -PSProvider FileSystem
|
||||
foreach($Drive in $Drives) {
|
||||
$ID = $Drive.Name
|
||||
@ -53,6 +54,7 @@ try {
|
||||
Write-Host "✅ Drive $ID has $(Bytes2String $Free) of $(Bytes2String $Total) free"
|
||||
}
|
||||
}
|
||||
Write-Progress -completed "Querying drives finished."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -39,8 +39,9 @@ try {
|
||||
} else {
|
||||
$Devices = $(smartctl --scan-open)
|
||||
}
|
||||
|
||||
Write-Progress "⏳ Querying S.M.A.R.T devices..."
|
||||
foreach($Device in $Devices) {
|
||||
Write-Progress "⏳ Querying S.M.A.R.T devices..."
|
||||
$Array = $Device.split(" ")
|
||||
$Device = $Array[0]
|
||||
if ("$Device" -eq "#") {
|
||||
@ -67,7 +68,7 @@ try {
|
||||
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-Progress -Completed " "
|
||||
Write-Progress -completed "Querying S.M.A.R.T devices finished."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#>
|
||||
|
||||
$Format="csv" # cap, csv, geojson, kml, kmlraw, quakeml, text, xml
|
||||
$MinMagnitude=5.8
|
||||
$MinMagnitude=5.7
|
||||
$OrderBy="magnitude" # time, time-asc, magnitude, magnitude-asc
|
||||
|
||||
function ListEarthquakes {
|
||||
@ -22,6 +22,7 @@ function ListEarthquakes {
|
||||
[int]$Depth = $Quake.depth
|
||||
New-Object PSObject -Property @{ Mag=$Quake.mag; Depth="$Depth km"; Location=$Quake.place; Time=$Quake.time }
|
||||
}
|
||||
Write-Progress -completed "Loading finished."
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user