Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote Computer Name 2

Status
Not open for further replies.

malaygal

IS-IT--Management
Feb 22, 2006
192
US
I used to be able to reference a remote file using the remote computer name (svrname) on the file name - i.e //svrname/some_dir/some_file.txt - in my vbscript
Recently, when I evaluate if this file exist, I am getting file not found even if the file exists.
My workaround is to use mapped-letter directory - i.e m:\s=ome_dir\some_file.txt.

Can anybody tell me what happened and how I can restore?

Any help will be greatly appreciated.
 
How are you referencing the remote file? FileSystemObject?
Have permissions changed on the server share?
 
I'd replace this:
//svrname/some_dir/some_file.txt
with this:
\\svrname\some_dir\some_file.txt

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks fot the quick responses.

PHV, I replace / with \, but still did not work.

guitarzan, I do not know if any permissions were changed. How do I check and can you tell me how to update permissions so that I can run my script from svrname2 using svrname in the file name?

Thanks again.
 
BTW, I referenced another remote computer name - ie. i.e //svrname3/some_dir/some_file.txt - and it worked.

Also, if I run my script below in svrname (computer name)

datafile = i.e //svrname/some_dir/some_file.txt
if fs.fileexists(datafile) then
'''''
end if

It will not find the file.

 
You can try browsing to "\\svrname", right-click over the "\some_dir" share and select "Properties", and check the security tab.

Or, browse to "\\svrname\some_dir" and make sure you can view/modify files.

How are you executing your script? From a command prompt (cscript.exe)? or double-clicking the vbs file? Or another way?
 
I was able to modify the file.

I tried both scheduling the script (Task Scheduler) and double-click to run the script.


 
I don't have a good reason why it's not working. The next thing I would try is to see if you can see ANY files in the root of that share:
Code:
Option Explicit
Dim fso, f, objFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("\\svrname\some_dir")
For Each objFile in f.Files
   Wscript.echo objFile.Path
Next

Another suggestion, make sure you don't have On Error Resume Next suppressing runtime errors.
 
Thanks for all your help so far, guitarzan.

I run the script on both host computer and remote computer and got same error. Line: 4, Error: Path not found, Code: 800A004C
 
Right-click the "\some_dir" share and select "Sharing", click on Permission button, added Everyone with Read permission. This did the trick.

Thanks for all the help,guitarzan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top