Files
PowerShell/docs/list-drives.md
Markus Fleschutz d8690419ea Updated the manuals
2025-06-22 10:38:33 +02:00

1.7 KiB

The list-drives.ps1 Script

This PowerShell script lists all local drives as a table.

Parameters

/Repos/PowerShell/scripts/list-drives.ps1 [<CommonParameters>]

[<CommonParameters>]
    This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, 
    WarningVariable, OutBuffer, PipelineVariable, and OutVariable.

Example

PS> ./list-drives.ps1



DriveLetter FriendlyName     FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining      Size
----------- ------------     -------------- --------- ------------ ----------------- -------------      ----
C           SSD              NTFS           Fixed     Healthy      OK                    449.65 GB 930.43 GB

Notes

Author: Markus Fleschutz | License: CC0

https://github.com/fleschutz/PowerShell

Script Content

<#
.SYNOPSIS
	Lists all drives
.DESCRIPTION
	This PowerShell script lists all local drives as a table.
.EXAMPLE
	PS> ./list-drives.ps1

	DriveLetter FriendlyName     FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining      Size
	----------- ------------     -------------- --------- ------------ ----------------- -------------      ----
	C           SSD              NTFS           Fixed     Healthy      OK                    449.65 GB 930.43 GB
.LINK
	https://github.com/fleschutz/PowerShell
.NOTES
	Author: Markus Fleschutz | License: CC0
#>

try {
	Get-Volume
	exit 0 # success
} catch {
	"⚠️ Error: $($Error[0])"
	exit 1
}

(page generated by convert-ps2md.ps1 as of 06/22/2025 10:37:37)