Post problem reports here for Batch files for use in BSOD debugging


  1. Posts : 1,777
    Windows 11 [21H2]
       #1251

    @zbook, try this:
    PowerShell Get-WmiObject win32_logicaldisk -computername %ComputerName%^|Select Name,VolumeName,@{Name='FreeSpace';Expression={($_.freespace / 1GB).ToString('0.00')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.00')}},@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A
      My Computers


  2. Posts : 41,462
    windows 10 professional version 1607 build 14393.969 64 bit
       #1252

    What if anything could be similar to dxdiag displayed results?

    For example:

    Code:
    ------------------------
    Disk & DVD/CD-ROM Drives
    ------------------------
          Drive: C:
     Free Space: 253.4 GB
    Total Space: 476.4 GB
    File System: NTFS
          Model: Samsung SSD 850 EVO 500GB
      My Computer


  3. Posts : 1,777
    Windows 11 [21H2]
       #1253

    zbook said:
    What if anything could be similar to dxdiag displayed results?

    For example:

    Code:
    ------------------------
    Disk & DVD/CD-ROM Drives
    ------------------------
          Drive: C:
     Free Space: 253.4 GB
    Total Space: 476.4 GB
    File System: NTFS
          Model: Samsung SSD 850 EVO 500GB
    See post 1254 if it suits your needs.

    [codeD:\>PowerShell Get-WmiObject win32_logicaldisk -computername %ComputerName%^|Select Name,VolumeName,@{Name='FreeSpace';Expression={($_.freespace / 1GB).ToString('0.00')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.00')}},@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A

    Name VolumeName FreeSpace Size Free %
    ---- ---------- --------- ---- ------
    C: 76.96 111.09 69.28
    D: Data 82.47 111.22 74.15
    E: 0.00 0.00
    F: Test Volume [SSD] 0.50 0.55 90.51
    H: 0.00 0.00



    D:\>[/code]
      My Computers


  4. Posts : 41,462
    windows 10 professional version 1607 build 14393.969 64 bit
       #1254

    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,@{Name='FreeSpace';Expression={($_.freespace / 1GB).ToString('0.00')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.00')}},@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A
    
    Name VolumeName      FreeSpace Size   Free %
    ---- ----------      --------- ----   ------
    C:   Windows         472.61    689.16  68.58
    D:   HP_TOOLS        1.91      2.00    95.45
    G:                   0.00      0.00
    K:   System Reserved 0.45      0.49    92.72
    
    
    
    C:\WINDOWS\system32>



    It skipped the recovery partition.





    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,@{Name='FreeSpace';Expression={($_.freespace / 1GB).ToString('0.00')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.00')}},@{Name='Free %';Expression={[math]::round(($_.freespace / $_.size)*100, 2)}}^|FT -A
    
    Name VolumeName      FreeSpace Size   Free %
    ---- ----------      --------- ----   ------
    C:   Windows         472.61    689.16  68.58
    D:   HP_TOOLS        1.91      2.00    95.45
    G:                   0.00      0.00
    K:   System Reserved 0.45      0.49    92.72
    
    
    
    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>
      My Computer


  5. Posts : 7,606
    Windows 10 Home 20H2
       #1255

    Code:
    PowerShell Get-Volume^|?{$_.Size}^|Sort DriveLetter^|FT -A
    It would be ideal if the output of the following could be integrated into that of the above.

    Code:
    PowerShell Get-Volume^|Select DriveLetter,SizeRemaining,Size,@{Name='Free space (%)';Expression={[math]::round(($_.SizeRemaining / $_.Size)*100, 2)}}^|?{$_.Size}^|Sort DriveLetter^|FT -A

    The recovery partition will not be skipped.
    My hidden "VTOYEFI" partition is not skipped either,
      My Computer


  6. Posts : 1,777
    Windows 11 [21H2]
       #1256

    Matthew Wai said:
    Code:
    PowerShell Get-Volume^|?{$_.Size}^|Sort DriveLetter^|FT -A
    It would be ideal if the output of the following could be integrated into that of the above.

    Code:
    PowerShell Get-Volume^|Select DriveLetter,SizeRemaining,Size,@{Name='Free space (%)';Expression={[math]::round(($_.SizeRemaining / $_.Size)*100, 2)}}^|?{$_.Size}^|Sort DriveLetter^|FT -A
    It uses Bytes.
    Code:
    D:\>PowerShell Get-Volume^|Select DriveLetter,SizeRemaining,Size,@{Name='Free space (%)';Expression={[math]::round(($_.SizeRemaining / $_.Size)*100, 2)}}^|?{$_.Size}^|Sort DriveLetter^|FT -A
    
    DriveLetter SizeRemaining         Size Free space (%)
    ----------- -------------         ---- --------------
                     89219072    640675840          13.93
    C             82631315456 119281807360          69.27
    D             88553566208 119420219392          74.15
    F               533344256    589295616          90.51
    
    
    
    D:\>

    @zbook
    This one:
    Code:
    PowerShell get-volume^|Select DriveLetter,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|FT -A
    Code:
    D:\>PowerShell get-volume^|Select DriveLetter,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|FT -A
    
    DriveLetter FileSystemType FreeSpace Size    Free %
    ----------- -------------- --------- ----    ------
              E Unknown        0.000     0.000
              H Unknown        0.000     0.000
              D NTFS           82.472    111.219 74.15
              C NTFS           76.959    111.090 69.28
                NTFS           0.083     0.597   13.93
              F NTFS           0.497     0.549   90.51
    
    
    
    D:\>
      My Computers


  7. Posts : 41,462
    windows 10 professional version 1607 build 14393.969 64 bit
       #1257

    Code:
    Microsoft Windows [Version 10.0.19043.1466]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32>PowerShell get-volume^|Select DriveLetter,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|FT -A
    
    DriveLetter FileSystemType FreeSpace Size    Free %
    ----------- -------------- --------- ----    ------
              K NTFS           0.452     0.487    92.72
              C NTFS           472.603   689.157  68.58
              D FAT32          1.909     2.000    95.45
                NTFS           6.256     6.980    89.62
              G Unknown        0.000     0.000
    
    
    
    C:\WINDOWS\system32>


    Code:
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Try the new cross-platform PowerShell https://aka.ms/pscore6
    
    PS C:\WINDOWS\system32> get-volume
    
    DriveLetter FriendlyName    FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining      Size
    ----------- ------------    -------------- --------- ------------ ----------------- -------------      ----
    K           System Reserved NTFS           Fixed     Healthy      OK                    462.69 MB    499 MB
    C           Windows         NTFS           Fixed     Healthy      OK                     472.6 GB 689.16 GB
    D           HP_TOOLS        FAT32          Fixed     Healthy      OK                      1.91 GB      2 GB
                Recovery        NTFS           Fixed     Healthy      OK                      6.26 GB   6.98 GB
    G                           Unknown        CD-ROM    Healthy      Unknown                     0 B       0 B
    
    
    PS C:\WINDOWS\system32>
      My Computer


  8. Posts : 1,777
    Windows 11 [21H2]
       #1258

    @zbook
    Try this:
    Code:
    powerShell get-volume^|Select DriveLetter,FileSystemLabel,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|sort DriveLetter^|FT -A
    Code:
    D:\>powerShell get-volume^|Select DriveLetter,FileSystemLabel,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|sort DriveLetter^|FT -A
    
    DriveLetter FileSystemLabel   FileSystemType FreeSpace Size    Free %
    ----------- ---------------   -------------- --------- ----    ------
                                  NTFS           0.083     0.597    13.93
    C                             NTFS           76.966    111.090  69.28
    D           Data              NTFS           82.472    111.219  74.15
    E                             Unknown        0.000     0.000
    F           Test Volume [SSD] NTFS           0.497     0.549    90.51
    H                             Unknown        0.000     0.000
    
    
    
    D:\>
      My Computers


  9. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #1259

    Hello,

    jbcarreon123 said:
    @zbook
    Try this:
    Code:
    powerShell get-volume^|Select DriveLetter,FileSystemLabel,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|sort DriveLetter^|FT -A
    Code:
    D:\>powerShell get-volume^|Select DriveLetter,FileSystemLabel,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|sort DriveLetter^|FT -A
    
    DriveLetter FileSystemLabel   FileSystemType FreeSpace Size    Free %
    ----------- ---------------   -------------- --------- ----    ------
                                  NTFS           0.083     0.597    13.93
    C                             NTFS           76.966    111.090  69.28
    D           Data              NTFS           82.472    111.219  74.15
    E                             Unknown        0.000     0.000
    F           Test Volume [SSD] NTFS           0.497     0.549    90.51
    H                             Unknown        0.000     0.000

    I don't know if you could use part of this or if it helps, but this is what I use for decimal places and alignment on one of my Commands . . .

    Code:
    
    PowerShell "Get-WmiObject -Class Win32_LogicalDisk | Format-Table DeviceId, VolumeName, @{n='Size (GB)';e={[math]::Round($_.Size/1GB, 2, 00).ToString('#.00')};Align='Right'}, @{n='Used (GB)';e={[math]::Round(($_.Size-$_.FreeSpace)/1GB, 2, 00).ToString('#.00')};Align='Right'}, @{n='Free (GB)';e={[math]::Round($_.FreeSpace/1GB, 2, 00).ToString('#.00')};Align='Right'}
    
    DeviceId VolumeName   Size (GB) Used (GB) Free (GB)
    -------- ----------   --------- --------- ---------
    C:                        30.03     14.86     15.17
    D:       Data             17.79     10.89      6.89
    E:                          .00       .00       .00
    S:       System_Image      7.00       .96      6.04
    
    

    I tried applying it to your above code but it says The Align key is not valid..
      My Computer


  10. Posts : 41,462
    windows 10 professional version 1607 build 14393.969 64 bit
       #1260

    Code:
    Microsoft Windows [Version 10.0.19043.1466]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32>powerShell get-volume^|Select DriveLetter,FileSystemLabel,FileSystemType,@{Name='FreeSpace';Expression={($_.sizeremaining / 1GB).ToString('0.000')}},@{Name='Size';Expression={($_.size / 1GB).ToString('0.000')}},@{Name='Free %';Expression={[math]::round(($_.sizeremaining / $_.size)*100, 2)}}^|sort DriveLetter^|FT -A
    
    DriveLetter FileSystemLabel FileSystemType FreeSpace Size    Free %
    ----------- --------------- -------------- --------- ----    ------
                Recovery        NTFS           6.256     6.980    89.62
    C           Windows         NTFS           472.615   689.157  68.58
    D           HP_TOOLS        FAT32          1.909     2.000    95.45
    G                           Unknown        0.000     0.000
    K           System Reserved NTFS           0.452     0.487    92.72
    
    
    
    C:\WINDOWS\system32>PowerShell "Get-WmiObject -Class Win32_LogicalDisk | Format-Table DeviceId, VolumeName, @{n='Size (GB)';e={[math]::Round($_.Size/1GB, 2, 00).ToString('#.00')};Align='Right'}, @{n='Used (GB)';e={[math]::Round(($_.Size-$_.FreeSpace)/1GB, 2, 00).ToString('#.00')};Align='Right'}, @{n='Free (GB)';e={[math]::Round($_.FreeSpace/1GB, 2, 00).ToString('#.00')};Align='Right'}
    
    DeviceId VolumeName      Size (GB) Used (GB) Free (GB)
    -------- ----------      --------- --------- ---------
    C:       Windows            689.16    216.54    472.61
    D:       HP_TOOLS             2.00       .09      1.91
    G:                             .00       .00       .00
    K:       System Reserved       .49       .04       .45
    
    
    
    C:\WINDOWS\system32>
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:54.
Find Us




Windows 10 Forums