Serach for free drive Space on all my SQL Servers

  • I have to Monitor all my SQL Servers included all development servers. Now i search for a way to create a job to get a lot of harddisk parameterns, to put it in a sql table on my monitoring server.

    At the Moment i run a script like this:

    Dim Report

    Set objFSO = CreateObject ("Scripting.FileSystemObject")

    Set WshNetwork = WScript.CreateObject("WScript.Network")

    Set objDrives = objFSO.Drives

    On Error Resume Next

    objFSO.DeleteFile("C:\Temp\ReportDrives"&WshNetwork.ComputerName&".txt")

    On Error GoTo 0

    Set Report = objFSO.OpenTextFile("C:\Temp\ReportDrives"&WshNetwork.ComputerName&".txt", 8, "True")

    For Each objLaufwerk In objDrives

     'WScript.Echo objLaufwerk.DriveLetter

     Select Case objLaufwerk.DriveType

      Case 0: strTyp ="Unbekannt"

      Case 1: strTyp ="Wechsellaufwerk"

      Case 2: strTyp ="Fest"

      Case 3: strTyp ="Netzwerk"

      Case 4: strTyp ="CD-ROM"

      Case 5: strTyp ="RAM-Drive"

     End Select

     'WScript.Echo strTyp

     If objLaufwerk.DriveType = 2 Then

      Report.Write(WshNetwork.ComputerName)

      Report.Write(";")

      Report.Write(objLaufwerk.DriveLetter)

      Report.Write(";")

      Report.Write(objLaufwerk.FileSystem)

      Report.Write(";")

        Report.Write(objLaufwerk.TotalSize)

        Report.Write(";")

       Report.Write(objLaufwerk.FreeSpace&vbcrlf)

      End If

    Next

     

    IT´s creates a local file wich the data i need, but i mut shedule it by OS and in the second step i must import these data into my Database.

    Have anyone an idea to make this easyer to handle with minumum of scheduled jobs that only run on sql server.

    Please let me Know.

    Kind Regard

    Michael

  • I run xp_fixeddrives on all my servers and it outputs a list of free space on each drive. You could insert that into a table, or have a SQL Agent job place it in a text file for you.



    Michelle

  • All the times it's crasy, where can I find information about this stored procedure? In BOL there are no information about this.

    Is there any ohter undokumented XP_? that is important?

     

    Kind Regards

    Michael

     

  • Sure thing!

    This is an introduction to some of the most interesting undocumented xp's

    http://www.sql-server-performance.com/ac_extended_stored_procedures.asp

    But keep in mind, that mostly they are undocumented for good reasons. So, evaluate carefully if you want to rely on such features in production code.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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