List Windows 10 disk space in GB

  • List Windows 10 disk space in GB

    Posted by Roddy Gelberty on 9 July 2020 at 10:29 am

    How can I list Windows 10 disk space in GB? I know the ‘Win32_LogicalDisk‘ wmi class contains that information. But how do I format it in a human readable format.

    Topaz George replied 3 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Topaz George

    Organizer
    9 July 2020 at 12:01 pm
    $disks = Get-WmiObject -Query "Select * from Win32_LogicalDisk where DriveType=3" -ComputerName $env:COMPUTERNAME -Namespace root\cimv2
    $fList = $disks | ForEach-Object {
    New-Object PSObject -Property @{
    'Name' = $_.DeviceID
    'Space in Total (GB)' = $_.Size / 1GB
    'Free Space in GB' = $_.FreeSpace / 1GB
    'Free Space as a %' = 100 * $_.FreeSpace / $_.Size
    }
    }
    $fList|Format-List
    

Log in to reply.

DCOM hardening issue.

This application fails to authenticate with WMI on the SCCM server because Microsoft has not yet hardened DCOM on their Windows Preinstallation Environment. We are working on a different approach, but it will only be released during the first quarter of 2024. But until that time, the only workaround will be to uninstall the update corresponding to KB5004442.