We help IT Professionals succeed at work.

Get information about network share using ASP FileSystemObject?

electricd7
electricd7 asked
on
Hello,

I am writing a new application in which I need to get info about a network share using ASP.  I am first trying FileSystemObject but keep getting an invalid procedure call or argument when I try the GetDrive method on the share.  Here is the code I am using:

      SET RS=Server.CreateObject("ADODB.Recordset")
      RS.Open "Select * from Storage", Application("Conn")
      While Not RS.EOF
            set fs=Server.CreateObject("Scripting.FileSystemObject")
            set d=fs.GetDrive(RS("share")
            response.write RS("share")&": "&d.FreeSpace&"<BR>"
            set d=nothing
            set fs=nothing
      RS.Movenext
      Wend
      RS.Close
      Set RS = Nothing

the value for RS("Share") is "\\10.1.11.5\Vol1$\data\public\NAS1".  This has to work where network drives are not mapped.  I can also specify a username/password combo for the share if necessary as the IUSER does not have access to the share, but the username/password is also stored in the DB.  Please help!
Comment
Watch Question

Author

Commented:
I guess I should specify that I am not really interested in freespace, although that is what i have in there.  I want to see what the USED space size is of that share (ie, how many bytes are in that folder).

Author

Commented:
Updated code...since the spec i am after is actually size, here is what I now have.  I now get a "Path Not Found" error.
	SET RS=Server.CreateObject("ADODB.Recordset")
	RS.Open "Select * from Storage", Application("Conn") 
	While Not RS.EOF
		share = "\\"&RS("Host_addr")&"\"&RS("share")
		response.write share
		set fs=Server.CreateObject("Scripting.FileSystemObject")
		set d=fs.GetFolder(share)
		response.write share&": "&d.size&"<BR>"
		set d=nothing
		set fs=nothing
	RS.Movenext
	Wend
	RS.Close
	Set RS = Nothing

Open in new window

Found solution myself.  Ran website under account which has access to this share rather than the anonymous user.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.