469,097 Members | 1,583 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,097 developers. It's quick & easy.

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.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 />")
set fo=nothing
set fs=nothing

....tried some MS solutions




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

Thank You in advance for any help you might provide

Jul 17 '07 #1
3 7303

"Jon Paal [MSMD]" wrote:
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

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

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

End if

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

Jul 18 '07 #3
you may need to try wsh questions here:

Jul 19 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Stavros | last post: by
7 posts views Thread by Benjamins via AccessMonster.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.