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

Please note that documentation and command names may be out of date while we work furiously towards 1.0


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

Get-Help

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