Posted on 2008-11-04
Last Modified: 2008-11-05
i have two different server one is a webserver and the other is a storage server,
in my web page using vbscript, i was trying to read the files inside the storage server but i keep getting invalid directory or file not found
this is the way i did it. could you tell me how to fix this thank you very much.
please help me asap. thank you very much
set objFSO = CreateObject("Scripting.FileSystemObject")

set objFile = objFSO.GetFile("\\server2\images\folder1\)

set objFolder = objFile.ParentFolder

set objFolderContents = objFolder.Files

Open in new window

Question by:StewSupport
    LVL 17

    Expert Comment

    by:Jared Luker
    It's probably a permissions issue.  The file and folder permissions have to be set up so that the anonymous or authenticated user account has at least read access to it.  If it does not, then Windows will deny access to the file.

    The file also has to be in a location that the web server can access.

    Author Comment

    how do i set it up then?
    LVL 17

    Expert Comment

    by:Jared Luker
    well.. I only know how to do it with IIS.

    If you are using anonymous access, then you need to set NTFS permissions on the folder1 that would give the anonymous account access to that file.

    If you need to know how to set up NTFS permissions, there are lots of articles here on EE and on the web to help you with that.
    LVL 65

    Accepted Solution

    You are missing a filename in your GetFile call, but I guess you must have omitted that on purpose?

    First, test straight from a VBS file, outside a web browser, from the desktop, to see if you've got the code right, then work permissions for the web page later.

    Try something like this.


    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder("\\Server2\Images")
    For Each objFile In objFolder.Files
       WScript.Echo objFile.Path

    Open in new window


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
    Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    732 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

    24 Experts available now in Live!

    Get 1:1 Help Now