What happens when you run it?
Perhaps you should set bWaitOnReturn to True so the page waits for it to finish...
http://www.devguru.com/Tec
Main Topics
Browse All TopicsI'm trying to get my ASP page to run a batch file [syncservers.cmd]. When the .cmd file is run via the command line everything works as it should. However my ASP page will not run it.
dim winShell
set winShell = server.createobject("wscri
winShell.run("d:\tools\syn
The IUSR and Everyone accounts have full access to both the file and the directory the file is in. I reregistered the DLL as well.
Help!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
What happens when you run it?
Perhaps you should set bWaitOnReturn to True so the page waits for it to finish...
http://www.devguru.com/Tec
You guys are fast....
JITGANGULY-
- D is a local drive and the ASP file is on the same drive
- No error code is returned, so it thinks it worked
- When running the script via a command prompt (including the path) it works
- The batch file only executes robocopy (used to sync files on multiple servers). IUSR and everyone have full rights to robocopy, the batch file, and the directory.
JOEPOSTER-
It depends on what parameters I give it. In this instance it returns nothing. I can assign it and response.write the response, and the return code is zero. If I set it to wait until complete, the browser hangs. I don't think you link is very applicable to my issue..
When doing this I get a response code of 16, for whatever that means:
dim winShell, intReturn
set winShell = server.createObject("WScri
intReturn = winShell.Run("%comspec% /c d:\tools\syncservers.cmd",
response.write intReturn
I just gave the link so you'd know the syntax of the run method.
How does robocopy reference the servers? You'll have problems if they are mapped drives as IIS runs as a service and can't see mapped drives.
To troubleshoot you could convert your .asp file to a .vbs and run it from the command line. If that works it's probably a permissions problem. You could also change IIS to run under your ID and see if that works.
Ahh.. I wonder if that is the issue. Robocopy syntax is like this
robocopy d:\inetpub\wwwroot\images \\12.96.xxx.xxx\images *.*
So it copies all of the images on the current box over to the others. Do you think the ASP process is unable to see the server when hit via IP?
I changed IIS to allow anon access, and for the anon user to be Administrator. No luck.
I renamed the file to .vbs, made the couple of requesite changes (Ie - server. to wscript.) and it worked when run via the command line.
Ideas?
It should be OK with an IP or UNC.
Did you clone iusr_machine on the destination server to give it permissions?
http://support.microsoft.c
Another option would be to run IIS under a domain ID instead of iusr.
Also, another quick test might be to use...
robocopy d:\inetpub\wwwroot\images d:\inetpub\wwwroot\images2
We don't run a domain for these boxes, so that isn't an option. And I don't have the IUSR account password which I changed in the process of troubleshooting. I've shot a request over to the primary admin to get it.
Your last suggestion ran correctly when executed from the web page. So at least that rules out a wscript bug and almost certainly is a permission problem across machines.
I should get the password tonight/tomorrow and will follow up. Thanks for the pointer, and I'll post when I find out something.
Did you try to get the password using one of these methods?
http://support.microsoft.c
Business Accounts
Answer for Membership
by: jitgangulyPosted on 2005-01-12 at 13:02:54ID: 13028614
Is d a physical drive ? or a share ? then use UNC shaer name like \\machinename\sharename
pt.shell") cservers.c md")
Also it will be executed on your web server
put error routine also like
dim winShell
on error resume next
set winShell = server.createobject("wscri
winShell.run("d:\tools\syn
if err.number <> 0 then
Response.write "Err " & Err.Description
end if
Also make sure whatever commands/functions you are runnign in that batch file, thta has proper permission i.e. IUSR guy should have permission to those commands
What is inside syncservers.cmd ?