Checking for Available Disk Space (outside of SQL Server)

  • We are running SQL Server 2005 SP4 on Windows Server 2008 R2 SE SP1 and Windows Server 2003 R2 SE SP2. I have created a SQL Server Job that returns free space using the xp_fixeddrives extended stored procedure. I was wondering if anyone knows of a simple, batch DOS job that would return the total and free space of the operating system and email the results. I would like to be able to find this information out without using SQL Server and without purchasing a third party product.

    Thanks in advance, Kevin

  • Hello Kevin,

    Please check this: http://ss64.org/viewtopic.php?id=930

    Regards..

  • Personally, I'd go with Powershell for this. Server 2003 will need it installed if it's not already (it's an optional update). 2008 ships with it installed.

    http://www.simple-talk.com/content/article.aspx?article=1339

  • The wmi comsole is pretty good here. The problem with xp_fixeddrives is it cant return mounted volume details. Use something along the lines of

    wmic volume get capacity, "free space", name

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Thanks for all the responses.

    Question1 - Why is this so difficult or cumbersome to do using the operating system? I think this is a common task that is required by network engineers, dbas, etc. I would like to check disk space at the operating system level and send an email just in case SQL Server is not running or for my servers where SQL Server is not installed.

    (In my SQL Server Stored Procedure, I used xp_fixeddrives to get the drive and freespace information. Then I use OLE Automation to get the Total Size of each drive. This works fine and I can schedule it and send emails by creating a job and using sp_send_dbmail.)

    Question2 - can the xp_fixeddrives stored procedure and OLE Automation be used with SQL Server Express 2005? Can a Job be setup and scheduled from SQL Server Express 2005?

    Thanks in advance, Kevin

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply