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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VG9kZA==?=

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

    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.Creat eObject("Script ing.FileSystemO bject")
    set fo=fs.GetFolder ("\\hostname\pr ocedures")

    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



    and



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

    Thank You in advance for any help you might provide

  • Jon Paal [MSMD]

    #2
    Re: Server.CreateOb ject(&quot;Scri pting.FileSyste mObject&quot;) on another serve




    this may help


    Comment

    • =?Utf-8?B?VG9kZA==?=

      #3
      Re: Server.CreateOb ject(&quot;Scri pting.FileSyste mObject&quot;) on another s



      "Jon Paal [MSMD]" wrote:
      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.CreateOb ject("WScript.S hell")
      Set WshNetwork = server.CreateOb ject("WScript.N etwork")
      Set CheckDrive = WshNetwork.Enum NetworkDrives()
      AlreadyConnecte d = False
      DriveLetter = "P:" 'DriveLetter must be a CAPITAL letter
      RemotePath = "\\server\share dfolder"
      username = "domainname\use rname"
      pass = "password"
      choice = "false"
      if CheckDrive.coun t 0 then
      For i = 0 To CheckDrive.Coun t - 1
      If CheckDrive.Item (i) = DriveLetter Then AlreadyConnecte d = True
      Next

      If AlreadyConnecte d = True then
      WshNetwork.Remo veNetworkDrive DriveLetter
      WshNetwork.MapN etworkDrive DriveLetter, RemotePath, choice, username, pass
      WshShell.PopUp "Drive " & DriveLetter & "Disconnect ed, then connected
      successfully."

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

      End if

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

      end if


      Thank You for your assistance

      Comment

      • Jon Paal [MSMD]

        #4
        Re: Server.CreateOb ject(&quot;Scri pting.FileSyste mObject&quot;) on another s

        you may need to try wsh questions here:

        microsoft.publi c.scripting.wsh


        Comment

        Working...