Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Script to display hard drive space using ASP?

  • 27-08-2003 2:36pm
    #1
    Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭


    Not sure if this should be here or in programming... im guessin here. If not throw this where it belongs ;)

    I've recently created an intranet site for the company i work for. Now one of the things i had to do was create a database with all the space/free space on each partition on the network and then display this on a page.(all done manually; go to each machine, check space and enter data in access database)
    What im wondering is if there is a script or something that can read how much space is available on each partition and then either write it to a database or display it using ASP.

    I've had a bit of a google but i wasn't really sure what to search for so i came up fairly blank. Any one got any ideas/

    Thanks for any help.


Comments

  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    you can try this

    <%
    Dim objFSO
    Dim objDrive

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set objDrive = objFSO.GetDrive("C:")

    Response.Write "<pre>" & vbCrLf

    Response.Write "Drive Letter: "
    Response.Write objDrive.DriveLetter
    Response.Write vbCrLf

    Response.Write "Volume Name: "
    Response.Write objDrive.VolumeName
    Response.Write vbCrLf

    Response.Write "Free Space: "
    Response.Write FormatNumber(objDrive.FreeSpace, 0) & " bytes"
    Response.Write vbCrLf

    Response.Write "Total Size: "
    Response.Write FormatNumber(objDrive.TotalSize, 0) & " bytes"
    Response.Write vbCrLf

    Response.Write "Percent Free Space: "
    Response.Write FormatPercent(objDrive.FreeSpace / objDrive.TotalSize)
    Response.Write vbCrLf

    Response.Write "</pre>" & vbCrLf

    Set objDrive = Nothing
    Set objFSO = Nothing
    %>


  • Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭BKtje


    Ah brilliant nice one :D

    Must read up on the File System Object (never used before).

    Highly Appreciated :D


  • Closed Accounts Posts: 135 ✭✭dynamic.ie


    Can't really give you much more than that. TomED really has covered it all there.

    FSO is a great thing to learn. You can do so much with it like control templates, backup files, move, delete, and so much more. There is a cool resource on FSO on sloppycode.net with examples and user comments on how to do it all. If you're interested in researching FSO, check out the link below....

    http://www.sloppycode.net/fso/?p=d
    Follow the links on the left!


    Best of luck...

    Dave


  • Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭BKtje


    Thx dynamic, will do :)
    If i have any questions afterwards ill be sure to ask :p


  • Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭BKtje


    Unfortunately i do have a question which a lot of people seem to be asking on that site with no really helpful answers...
    How can i check how much disk space is on a network drive? I've tried the example they had there ("\\networkdrive") but unfortunately it didn't work. Gives me an
    Invalid procedure call or argument

    Any one got any ideas?

    Thanks again.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    My gut feeling would be that its a Permissions problem.

    You may have to give the IUSR access to the drive or network resource first.

    Try mapping the drive too.


  • Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭BKtje


    I have tried mapping the drive but it gives the same error as above ie "Invalid procedure call or argument".
    Incidentally, if you try to tell it to read a folder as a drive it gives that error so im wondering wether a mapped network drive is just seen as a folder or something.

    Sorry for a question which seems quite silly to me but how do i give the IUSR access to the drive? I tried setting it on the 'security' section of the mapped network drive but couldn't see anything there. Would you mind explaining it please?

    As a work around, i'm assuming a 'daisy chain' would work.
    eg.
    I check the local drive disk space on machine (a) then redirect it to machine (b) where the code is run which then redirects to machine (c) and so forth. (I realise IIS would need to be enabled on each machine tho)


  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    I havent had a chance to look into to this any further - but i would find it strange if it wasn't possible especially if its a mapped drive.

    The permissions will be different per set-up I would guess.

    For example, if your network uses a domain you would probably have to add the user to the domain (anyone that knows differ please help us out!).

    If you don't use a domain - go to the machine you want to access and have a look at the security tab add the user IUSR_COMPUTERNAME to the list.

    If you need more explanation than that let me know.

    Sorry forgot to mention.
    COMPUTERNAME being the name of the computer that IIS is running on!


  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    This is the best I could come up with!

    It seems like its possible alright!

    http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20693420.html

    Tom


  • Registered Users, Registered Users 2 Posts: 8,081 ✭✭✭BKtje


    Thanks Tom
    will have a look at it now.


    and we are running a domain here.


  • Advertisement
Advertisement