SQLServerWiki

“The Only Thing That Is Constant Is Change”

powershell command to check disk space on mount points.

Posted by database-wiki on February 7, 2017

Get-WmiObject win32_volume | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name=”CapacityGB”;Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name=”FreeSpaceGB”;Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name=”FreeSpacePercent”;Expression={[math]::round(($_.FreeSpace/($_.Capacity*1.00))*100.00,2)}} , @{Name=”Date”;Expression={$(Get-Date -f s)}}| Sort-Object Name

Output:

SystemName       :
Name             : D:\SQLServer\data\
BlockSize        : 65536
Capacity         : 214611984384
FreeSpace        : 10682368
DriveLetter      :
CapacityGB       : 199.87
FreeSpaceGB      : 0.01
FreeSpacePercent : 0
Date             : 2017-02-06T20:42:16

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: