dbatools is a free PowerShell module with over 180 SQL Server administration, best practice and migration commands included.


This command returns storage information for all local drives on a server, including server name, name of disk, label of disk, total size, free size and percent free.




To show disk space for sqlserver2014a in GB

Get-DbaDiskSpace -ComputerName sqlserver2014a

To show disk space for server1, server2 and server3, in megabytes

Get-DbaDiskSpace -ComputerName server1, server2, server3 -Unit MB


From PowerShell, execute Get-Help Get-DbaDiskSpace -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaDiskSpace.ps1 on GitHub

Related commands