• JimAtWork (2/3/2014)


    I have the same challenge and I have to query thousands of servers many of which do not allow the use of OA_ and also do not allow the use of Powershell for security reasons. Any work-arounds for that? TIA

    Not the most elegant solution, and only works for 2008R2+. but it gets the job done.

    SELECT distinct(volume_mount_point), total_bytes/1048576 as Size_in_MB, available_bytes/1048576 as Free_in_MB

    FROM sys.master_files AS f CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id)

    group by volume_mount_point, total_bytes/1048576, available_bytes/1048576 order by 1

    from: http://msdn.microsoft.com/en-us/library/hh223223.aspx and some Pinal Dave advices.

    read more at: http://thelonelydba.wordpress.com/2014/09/03/ms-sql-find-total-server-disk-space-in-t-sql

    hope this helps!