Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Finding out Total Disk Space in TSQL Expand / Collapse
Author
Message
Posted Monday, February 3, 2014 9:04 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, May 16, 2014 3:14 PM
Points: 7, Visits: 10
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


Kindest Regards,

JimAtWork
Post #1537374
Posted Wednesday, September 3, 2014 1:36 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 5:49 AM
Points: 25, Visits: 170
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!
Post #1610251
Posted Wednesday, September 3, 2014 3:47 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:34 PM
Points: 35,352, Visits: 31,891
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


Sorry for the late reply but, Yes... DOS batch code with calls to WMI.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1610302
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse