Solved

Check Harddrive space and total drive listings for all servers

Posted on 2004-10-26
198 Views
Last Modified: 2010-04-23
I have a list of servers (actual servers on our network) that I am returning from a SQL stored procedure query via a datareader - what I would like to do is to cycle through of the of records returened and check and display the harddrive space and drives on each of the servers - Is this even possible and if so, how?
0
Question by:tbaseflug
    7 Comments
     
    LVL 25

    Expert Comment

    by:RonaldBiemans
    maybe look ,

    here

    http://www.freevbcode.com/ShowCode.Asp?ID=5588

    or you could use WMI
    0
     
    LVL 25

    Expert Comment

    by:RonaldBiemans
    sorry forgot the link for wmi

    http://www.freevbcode.com/ShowCode.Asp?ID=1550
    0
     
    LVL 25

    Accepted Solution

    by:
    I see the link for WMI was for VB6,

    but this is how it is done in .net (don't forget to reference system.management

    Public Function GetDiskSpace() As System.UInt64
    Dim diskClass As _
    New System.Management.ManagementClass("Win32_LogicalDisk")
    Dim disks As System.Management.ManagementObjectCollection = _
    diskClass.GetInstances()
    Dim disk As System.Management.ManagementObject
    Dim space As System.UInt64
    For Each disk In disks
    If CStr(disk("Name")) = "C:" Then
    space = CType(disk("FreeSpace"), System.UInt64)
    End If
    Next disk
    Return space
    End Function
    0
     

    Author Comment

    by:tbaseflug
    RonaldBiemans -

    How would I displaythe results to a web page?
    0
     

    Author Comment

    by:tbaseflug
    Also, how would I use the above to reference a harddrive of a remote server?
    0
     
    LVL 6

    Expert Comment

    by:The_Biochemist
    'create your string from the variables
    Dim strOutput as string = disk & " has " & space & " kb Free"
    'write it to the page
    response.write(strOutput)
    0
     
    LVL 6

    Expert Comment

    by:The_Biochemist
    in the interim before finding out how to  reference the drives on a remote server with code you could map them as local drives and set the permissions for ASPNET. It is not the best solution but certainly the easiest!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    857 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now