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
Old Hand
Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)

Group: General Forum Members
Points: 304 Visits: 649
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
SSC Eights!
SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)SSC Eights! (928 reputation)

Group: General Forum Members
Points: 928 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
Old Hand
Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)

Group: General Forum Members
Points: 304 Visits: 649
Thanks, but I can't use cmdshell - frustrating I know!
snomadj
snomadj
Old Hand
Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)

Group: General Forum Members
Points: 304 Visits: 649
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
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29935 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
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29935 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
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2289 Visits: 6894
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
Old Hand
Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)Old Hand (304 reputation)

Group: General Forum Members
Points: 304 Visits: 649
thanks guys. appreciate your time. i'll have a look @ those options now.
salimdkg4
salimdkg4
Valued Member
Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)

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

thanxs
salimdkg4
salimdkg4
Valued Member
Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)

Group: General Forum Members
Points: 61 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