New
#1241
Try:
PowerShell Get-Volume^|?{$_.Size}^|Sort DriveLetter^|FT -A
It is possible to calculate the percentage of free space via additional commands.
Last edited by Matthew Wai; 21 Jan 2022 at 00:20.
Try:
PowerShell Get-Volume^|?{$_.Size}^|Sort DriveLetter^|FT -A
It is possible to calculate the percentage of free space via additional commands.
Last edited by Matthew Wai; 21 Jan 2022 at 00:20.
The prior commands did not display results for the recovery partition:
Code:Microsoft Windows [Version 10.0.19043.1466] (c) Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>PowerShell Get-Volume^|Select DriveLetter, Size, SizeRemaining^|?{$_.Size}^|?{$_.DriveLetter}^|Sort DriveLetter DriveLetter Size SizeRemaining ----------- ---- ------------- C 739976933376 507492831232 D 2147483648 2049859584 K 523235328 485167104 C:\WINDOWS\system32>PowerShell [System.IO.DriveInfo]::GetDrives^(^)^|Select Name, TotalSize, AvailableFreeSpace, VolumeLabel^|?{$_.TotalSize} Name TotalSize AvailableFreeSpace VolumeLabel ---- --------- ------------------ ----------- C:\ 739976933376 507492438016 Windows D:\ 2147483648 2049859584 HP_TOOLS K:\ 523235328 485167104 System Reserved C:\WINDOWS\system32>PowerShell Get-Volume^|?{$_.Size}^|Sort DriveLetter^|FT -A DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size ----------- ------------ -------------- --------- ------------ ----------------- ------------- ---- Recovery NTFS Fixed Healthy OK 6.26 GB 6.98 GB C Windows NTFS Fixed Healthy OK 472.62 GB 689.16 GB D HP_TOOLS FAT32 Fixed Healthy OK 1.91 GB 2 GB K System Reserved NTFS Fixed Healthy OK 462.69 MB 499 MB C:\WINDOWS\system32>
The following will display a device whose size is "0 B".
PowerShell Get-Volume^|Sort DriveLetter^|FT -A
A dysfunctional device's storage size could be "0 B".
My empty DVD drive's storage size is "0 B".
My empty card reader's storage size is "0 B".
Code:Microsoft Windows [Version 10.0.19043.1466] (c) Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>fsutil volume diskfree C: Total free bytes : 507,466,088,448 (472.6 GB) Total bytes : 739,976,933,376 (689.2 GB) Total quota free bytes : 507,466,088,448 (472.6 GB) C:\WINDOWS\system32>fsutil volume diskfree d: A local NTFS volume is required for this operation. Total free bytes : 2,049,859,584 (1.9 GB) Total bytes : 2,147,483,648 (2.0 GB) Total quota free bytes : 2,049,859,584 (1.9 GB) C:\WINDOWS\system32>fsutil volume diskfree k: Total free bytes : 485,167,104 (462.7 MB) Total bytes : 523,235,328 (499.0 MB) Total quota free bytes : 485,167,104 (462.7 MB) C:\WINDOWS\system32>
Can you create a command that displays results in GB? for all drives? whether they do or do not have designated drive letters?
Code:Microsoft Windows [Version 10.0.19043.1466] (c) Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>PowerShell Get-Volume^|Sort DriveLetter^|FT -A DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size ----------- ------------ -------------- --------- ------------ ----------------- ------------- ---- Recovery NTFS Fixed Healthy OK 6.26 GB 6.98 GB C Windows NTFS Fixed Healthy OK 472.61 GB 689.16 GB D HP_TOOLS FAT32 Fixed Healthy OK 1.91 GB 2 GB G Unknown CD-ROM Healthy Unknown 0 B 0 B K System Reserved NTFS Fixed Healthy OK 462.69 MB 499 MB C:\WINDOWS\system32>
Run the following one line of commands from Command Prompt.
Code:PowerShell Get-WmiObject win32_logicaldisk -computername %ComputerName%^|Select Name,VolumeName,Freespace,Size,@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A
I am not knowledgeable enough to answer the questions.
It skipped the recovery partition (no drive letter):
Code:Microsoft Windows [Version 10.0.19043.1466] (c) Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>PowerShell Get-WmiObject win32_logicaldisk -computername %ComputerName%^|Select Name,VolumeName,Freespace,Size,@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A Name VolumeName Freespace Size Free % ---- ---------- --------- ---- ------ C: Windows 507475628032 739976933376 68.58 D: HP_TOOLS 2049859584 2147483648 95.45 G: K: System Reserved 485167104 523235328 92.72 C:\WINDOWS\system32>
Ideally the commands/results would display:
a) all drives (whether they do or do not have designated drive letters)
b) drive size in GB
c) free space in GB
d) % free
Ideally, you should turn to an expert instead of me.