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

Robocopy 1.96 script

Status
Not open for further replies.

cretanion

Technical User
Jan 28, 2002
53
US
Should this script work in a web page? When I look at the log file the date is still an old one and nothing is being copied over.
<%
'Setup source and destination locations
strLocation = "\it\call"
strSource = "\\server02\d$\inetpub\websterstaging\"
strDestination = "\\server01\d$\inetpub\
'Use robocopy to copy files and ACLs
Set objExec = Server.CreateObject("ASPExec.Execute")
objExec.Application = strRun
strRun = "cmd /c robocopy " & strSource & strLocation & " " & strDestination & strLocation & " " & "/S /SEC /LOG:MyLogfile.txt /V /MIR "
' Response.Write objExec.Application
' response.write strRun
strResult = objExec.ExecuteDosApp
Set objExec = nothing
%>
 
The value of the strRun variable needs to be set to the command string BEFORE the objExec.Application property is set to strRun.

For the same reason this will not write "text":[tt]
X = Y
Y = "test"
Response.Write X[/tt]

But, perhaps more importantly, the default web user account does not have access to network resources. The IUSR_MachineName account is a local account the web server machine and, as such, has no permissions beyond that single machine.

Use the IIS Admin tool to configure permissions so that either anonymous access is denied or, alternatively, a network account is used instead of the default local account. For security purposes it is best to only change the permissions on the single file when needed rather than the entire site.


 
Fixed the script, but it still does not run. I will check the permissions, thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top