Disk Capacities

  • Comments posted to this topic are about the item Disk Capacities

  • Hi,

    when ever i executed this script i am getting errors.

    i am not getting o/p.

    can you help me on this??

    please check the errors below.

    Msg 102, Level 15, State 1, Line 6

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Line 10

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Line 27

    Incorrect syntax near '?'.

    Msg 102, Level 15, State 1, Line 51

    Incorrect syntax near '?'.

  • Drop the cursors and the calls to xp_fixeddrives and fsutil and use the following

    [Code]wmic volume get capacity, "free space", name[/code]

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

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

  • A nice script.

    Thanks

  • Hi, will this give results for all storage volumes and virtual drives associated with a NAS and VMs respectively, or is this for the drives on the machine (virtual or otherwise) which runs the SQL Server Db engine? Thanks!

  • I also got the line errors

    when you copy and paste the script from the webbrowser (firefox in my case) into SSMS it does not seem to work.

    I have now copied and pasted the text into notepad++ which revealed many of the spaces are defined as square boxes which normally refer to unrecognised text.

    By doing a search and replace on all these square boxes and replacing them with a spacebar character, then copying and pasting this from notepad ++ into SSMS worked just fine.

    This is a useful script for SQL Admins that if implemented correctly could help them check or even warn them when their SQL servers run out of disk space. However I normally find most organisations that run sql servers, also run other non sql servers and will have some means of monitoring disk space on all the servers.

    Writing your own to monitor disk space, whilst fun, might suggest you have already been at the short end of the stick because they have not warned you about disk space shortage and you had a server stop responding because of lack of disk space.

    As other servers on the network are quite often also bussiness critical, I would think it makes more sense ensuring the tool used for monitoring disk space accross the board (not just sql servers) is used instead.

    Alternatively, since you are using cmdshell, why not setup scheduled tasks on all servers (not just SQL) that run at regular intervals, running batch files to collect the same information and placing it into one SQL server where reporting services can be used to send you a regular email of all servers (not just SQL) where disk space is below either 1GB or 1% of capacity.

    T

  • Hi Guys

    This is very weird...

    I believe I wrote this about 4/5 years ago and submitted it back then to SQLServerCentral... I have no idea why it is popping up now as a script of the day.

    It is a little dated and a lot less relevant now days.

    Heck, this info is now available in a quick query to to SQL's dmv's.

    Strange?

    Anyway, Happy SQL Adventuring!

Viewing 7 posts - 1 through 7 (of 7 total)

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