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


Get-DbaDiskSpace

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.

Screenshots

get-dbadiskspace

Examples

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. Want to see the source code? See it on GitHub