List all devices, partitions and volumes in Powershell

Viewed 216667

I have multiple volumes (as nearly everybody nowadays): on Windows they end up specified as C:, D: and so on. How do I list these all like on a Unix machine with "ls /mnt/" with Powershell?

11 Answers

You can also do it on the CLI with

net use

You can use the following to find the "total" disk size on a drive as well.

Get-CimInstance -ComputerName yourhostname win32_logicaldisk | foreach-object {write " $($.caption) $('{0:N2}' -f ($.Size/1gb)) GB total, $('{0:N2}' -f ($_.FreeSpace/1gb)) GB free "}

Related