Check Mount Points and Disk Free Space with PowerShell

Those who know me will know that this post is a little out of the ordinary… I am posting about PowerShell. I have done one previously about Backing up and restoring site collection in SharePoint, so believe me I will admit that it has its place.  Well I was onsite with a client today and found another use for PowerShell: checking the size of and free space on mount points on an HP appliance.  This method will work with any machine, but this specifically happen to be on a server using mount points.  The script isn’t exactly friendly to remember, but that’s what you have that little bookmark button at the top of the browser for.  🙂
Mount points are specialized NTFS file system objects used to provide entry into another volume.  In this particular case the fast track hardware from HP used mount points to connect to the storage for a combined total of over 24 TB.  I didn’t want to leave that amount of storage or the 200GB of memory behind, but it had to happen.   Anyway, you can’t just right click on the mount point (which just shows up as a shortcut on the file system) and go to properties to see the amount of storage available.  Nor can you open My Computer and right click and do that for the C: drive because it will show you just the C drive, not all the mount points.  The following PowerShell script to the rescue.  It will display the storage total size and amount of free space in bytes, so you have to do a little conversion to get it into a useful number for you.
gwmi win32_volume|where-object {$_.filesystem -match “ntfs”}|ft name,capacity,freespace
The output will look something like this:

About the author

Bradley Schacht

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Jacksonville, FL. Bradley is a former consultant, trainer, and has authored 5 SQL Server and Power BI books, most recently the Microsoft Power BI Quick Start Guide. As a member of the Microsoft Fabric product team, Bradley works directly with customers to solve some of their most complex data problems and helps shape the future of Microsoft Fabric. He frequently presents at community events around the country, is a contributor to sites such as SQLServerCentral.com, and is a member of the Jacksonville SQL Server User Group (JSSUG).

6 comments

Leave a Reply to Maria Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Thank you so much …
    I was all worried about how to check free for Mounted drive as this are mounted in folder on d:
    I could check out space for d: [Win32_LogicalDisk] and concerned about mounded drive in folder in D:

  • try
    Get-WmiObject Win32_Volume -ComputerName LocalHost `
    | Format-Table Name, `
    @{Name=”Size(MB)”;Expression={“{0:0,0.00}” -f($_.Capacity/1mb)}}, `
    @{Name=”Free Space(MB)”;Expression={“{0:0,0.00}” -f($_.FreeSpace/1mb)}}, `
    @{Name=”Free (%)”;Expression={“{0,6:P0}” -f(($_.FreeSpace/1mb) / ($_.Capacity/1mb))}}, `
    @{Name=”Block Size”;Expression={“{0,6}” -f($_.BlockSize/1kb)+”k”}}, DeviceID –AutoSize

Bradley Schacht

Bradley Schacht is a Principal Program Manager on the Microsoft Fabric product team based in Jacksonville, FL. Bradley is a former consultant, trainer, and has authored 5 SQL Server and Power BI books, most recently the Microsoft Power BI Quick Start Guide. As a member of the Microsoft Fabric product team, Bradley works directly with customers to solve some of their most complex data problems and helps shape the future of Microsoft Fabric. He frequently presents at community events around the country, is a contributor to sites such as SQLServerCentral.com, and is a member of the Jacksonville SQL Server User Group (JSSUG).

Follow Me