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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats wrong with my script? Very basic...

Status
Not open for further replies.

ang3c0

IS-IT--Management
Jul 16, 2008
1
US
Before I get flamed, I'm VERY new to VBscripting and am just learning by browsing the internet. I'm trying to have a script that will check for a file on the client computer, and copy it from the our server if necessary. This file enables client communication for a help desk program we use.

Here's what I have so far:

local_path = "%USERPROFILE%\Application Data\AR System\HOME\AR"
server_path = "\\(servername)\shared\NCC\Scripts\AR"

Set objFSO = CreateObject("Scripting.FileSystemObject")

'add user profile to local_path


'check if file exists
If objFSO.FileExists(local_path) = False Then
'copy file
objFSO.CopyFile server_path, local_path
End if

Now if I change the paths and run this from a client machine, it works fine. But trying to run it from the server gives me:

---------------------------------------------------
Windows Script Host
Script: \\(servername)\Shared\ncc\scripts\ARScript.vbs
Line: 12
Char: 1
Error: Path not found
Code: 800A004C
Source: Microsoft VBScript runtime error
-----------------------------------------------------

I'm lost, as another script I have doing the SAME thing works fine, and all the file paths are correct, permissions are set, etc. Any thoughts are very much appreciated.
 
If you are running this on the same server where the data is stored, then it is probably the UNC paths. Try changing the code to the physical path e.g. d:\data\shared\etc\file.vbs

Mike

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top