SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


get total disk space per instance from within SQL without cmdshell.


get total disk space per instance from within SQL without cmdshell.

Author
Message
snomadj
snomadj
Right there with Babe
Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)

Group: General Forum Members
Points: 752 Visits: 670
For policy reasons I can't enable cmdshell.

I can get disk free space via xp_fixeddrives. But is it possible to get total disk space (ie. free space + used space).

I need this for all drives (so can't minus SQL file sizes off free space as there are non sql files).

I need to run on multiple instances & regularly.

Thanks in advance!
Syed Jahanzaib Bin hassan
Syed Jahanzaib Bin hassan
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2082 Visits: 481
declare @driveName varchar(100)
declare @query varchar(1000)
declare @fsinfo varchar(1000)

set @driveName = 'C'

set @query ='fsutil volume diskfree '+@driveName+':\'
set @fsinfo = 'fsutil fsinfo volumeinfo '+@driveName+':\'

exec xp_cmdshell @query
exec xp_cmdshell @fsinfo

check this T-SQL

Regards,
Syed Jahanzaib Bin Hassan
BSCS | MCTS | MCITP | OCA | OCP | OCE | SCJP | IBMCDBA

My Blog
www.aureus-salah.com
snomadj
snomadj
Right there with Babe
Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)

Group: General Forum Members
Points: 752 Visits: 670
Thanks, but I can't use cmdshell - frustrating I know!
snomadj
snomadj
Right there with Babe
Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)

Group: General Forum Members
Points: 752 Visits: 670
By which I mean I'm prevented by standard operating procs here ... not that there's a technical issue in doing so.
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63727 Visits: 9671
Syed Jahanzaib Bin hassan (5/11/2011)
declare @driveName varchar(100)
declare @query varchar(1000)
declare @fsinfo varchar(1000)

set @driveName = 'C'

set @query ='fsutil volume diskfree '+@driveName+':\'
set @fsinfo = 'fsutil fsinfo volumeinfo '+@driveName+':\'

exec xp_cmdshell @query
exec xp_cmdshell @fsinfo

check this T-SQL



Forgot to read again???
Ninja's_RGR'us
Ninja's_RGR'us
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63727 Visits: 9671
Is powershell an option? I can't code with it but I'm sure google would solve that one for ya.

<oi>sql?

SSIS?
Ian Scarlett
Ian Scarlett
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4928 Visits: 7136
You could always use SP_OACreate.

Look at this thread for a possible script:-
http://www.sqlservercentral.com/Forums/Topic113227-5-1.aspx



snomadj
snomadj
Right there with Babe
Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)Right there with Babe (752 reputation)

Group: General Forum Members
Points: 752 Visits: 670
thanks guys. appreciate your time. i'll have a look @ those options now.
salimdkg4
salimdkg4
SSC Journeyman
SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)

Group: General Forum Members
Points: 75 Visits: 30
itws working

thanxs
salimdkg4
salimdkg4
SSC Journeyman
SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)SSC Journeyman (75 reputation)

Group: General Forum Members
Points: 75 Visits: 30
thnxs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search