Server.CreateObject("Scripting.FileSystemObject") on another serve

Discussion in 'ASP General' started by Todd, Jul 17, 2007.

  1. Todd

    Todd Guest

    trying to access files located on another server within the network. the
    folder is shared out and we created a virtual directory as well.
    The error is Microsoft VBScript runtime error '800a004c' Path not found

    Here is my code

    <%

    dim fs,fo,x
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set fo=fs.GetFolder("\\hostname\procedures")

    for each x in fo.files
    'Print the name of all files in the test folder
    Response.write(x.Name & "<br />")
    next
    set fo=nothing
    set fs=nothing
    %>

    ....tried some MS solutions

    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197964

    and

    http://databases.aspfaq.com/databas...-database-or-text-file-on-another-server.html

    The previous was from a post on this page from May 2007.

    Thank You in advance for any help you might provide
     
    Todd, Jul 17, 2007
    #1
    1. Advertising

  2. Todd

    Todd Guest

    Re: Server.CreateObject("Scripting.FileSystemObject") on another s

    "Jon Paal [MSMD]" wrote:

    > http://forum.echoechoplus.com/showthread.php?threadid=7948
    >
    >
    > this may help
    >
    >
    >


    I've tried the WshNetwork route...still cant' get a successful connection
    but I'm getting other error messages which suggest to me that at least it can
    see the map.

    I've been trying different drive letters usernames, passwords etc to try and
    get a successful hookup.

    However, when I run the code now it knocks out my IIS (or so it
    appears)......I have to go and reboot the webserver. Wondering whats causing
    that. Heres the script

    Set WshShell = server.CreateObject("WScript.Shell")
    Set WshNetwork = server.CreateObject("WScript.Network")
    Set CheckDrive = WshNetwork.EnumNetworkDrives()
    AlreadyConnected = False
    DriveLetter = "P:" 'DriveLetter must be a CAPITAL letter
    RemotePath = "\\server\sharedfolder"
    username = "domainname\username"
    pass = "password"
    choice = "false"
    if CheckDrive.count > 0 then
    For i = 0 To CheckDrive.Count - 1
    If CheckDrive.Item(i) = DriveLetter Then AlreadyConnected = True
    Next

    If AlreadyConnected = True then
    WshNetwork.RemoveNetworkDrive DriveLetter
    WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
    WshShell.PopUp "Drive " & DriveLetter & "Disconnected, then connected
    successfully."

    Else
    WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
    WshShell.PopUp "Drive " & DriveLetter & " connected successfully."

    End if

    else
    WshNetwork.MapNetworkDrive DriveLetter, RemotePath, choice, username, pass
    ***this is where is hangs***
    WshShell.PopUp "Drive " & DriveLetter & " connected successfully."

    end if


    Thank You for your assistance
     
    Todd, Jul 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    2,720
  2. Lin Ma
    Replies:
    2
    Views:
    326
    Lin Ma
    Jun 10, 2004
  3. Andrew
    Replies:
    5
    Views:
    174
    Bob Barrows [MVP]
    Jun 15, 2004
  4. MoF
    Replies:
    4
    Views:
    498
  5. ashish
    Replies:
    1
    Views:
    448
    ashish
    Aug 14, 2007
Loading...

Share This Page