Changed list-drives.ps1 to use Get-Volume

This commit is contained in:
Markus Fleschutz 2025-05-19 10:14:49 +02:00
parent 53345ebdcf
commit 6edf5cc843

View File

@ -6,9 +6,9 @@
.EXAMPLE .EXAMPLE
PS> ./list-drives.ps1 PS> ./list-drives.ps1
Name Root Used (GB) Free (GB) DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size
---- ---- --------- --------- ----------- ------------ -------------- --------- ------------ ----------------- ------------- ----
C C:\ 6648,1 744,2 C SSD NTFS Fixed Healthy OK 449.65 GB 930.43 GB
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -16,9 +16,9 @@
#> #>
try { try {
Get-PSDrive -PSProvider FileSystem | format-table -property Name,Root,@{n="Used (GB)";e={[math]::Round($_.Used/1GB,1)}},@{n="Free (GB)";e={[math]::Round($_.Free/1GB,1)}} Get-Volume
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error: $($Error[0])"
exit 1 exit 1
} }