mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 02:18:21 +02:00
Update check-drives.ps1
This commit is contained in:
parent
188653a71d
commit
15f69e32aa
@ -17,24 +17,19 @@
|
|||||||
|
|
||||||
param([int64]$minLevel = 10) # 10 GB minimum
|
param([int64]$minLevel = 10) # 10 GB minimum
|
||||||
|
|
||||||
function Bytes2String { param([int64]$bytes)
|
function Bytes2String { param([int64]$number)
|
||||||
if ($bytes -lt 1000) { return "$bytes bytes" }
|
if ($number -lt 1KB) { return "$number bytes" }
|
||||||
$bytes /= 1000
|
if ($number -lt 1MB) { return '{0:N0}KB' -f ($number / 1KB) }
|
||||||
if ($bytes -lt 1000) { return "$($bytes)KB" }
|
if ($number -lt 1GB) { return '{0:N0}MB' -f ($number / 1MB) }
|
||||||
$bytes /= 1000
|
if ($number -lt 1TB) { return '{0:N0}GB' -f ($number / 1GB) }
|
||||||
if ($bytes -lt 1000) { return "$($bytes)MB" }
|
if ($number -lt 1PB) { return '{0:N0}TB' -f ($number / 1TB) }
|
||||||
$bytes /= 1000
|
return '{0:N0}GB' -f ($number / 1PB)
|
||||||
if ($bytes -lt 1000) { return "$($bytes)GB" }
|
|
||||||
$bytes /= 1000
|
|
||||||
if ($bytes -lt 1000) { return "$($bytes)TB" }
|
|
||||||
$bytes /= 1000
|
|
||||||
return "$($bytes)PB"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Progress "Querying drives..."
|
Write-Progress "Querying drives..."
|
||||||
$drives = Get-PSDrive -PSProvider FileSystem
|
$drives = Get-PSDrive -PSProvider FileSystem
|
||||||
$minLevel *= 1000 * 1000 * 1000
|
$minLevel *= 1GB
|
||||||
Write-Progress -completed " "
|
Write-Progress -completed " "
|
||||||
foreach($drive in $drives) {
|
foreach($drive in $drives) {
|
||||||
$details = (Get-PSDrive $drive.Name)
|
$details = (Get-PSDrive $drive.Name)
|
||||||
|
Loading…
Reference in New Issue
Block a user