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

Access Denied Running Batch File 1

Status
Not open for further replies.

cruford

Programmer
Dec 6, 2002
138
US
I have a batch file located at c:\inetpub\scripts\pca.bat. The contents of the batch file start pcAnywhere and take an IP address as a parameter:

Start "" "C:\Program Files\Symantec\pcAnywhere\AWREM32.EXE" "P:\Programs\pcAnywhere\Template.chf" /C%1


I am trying to call this batch file with ASPExec on a Windows XP pro box for testing (IIS5). Here is the code calling it:

<%
If Len(Request.QueryString("IP")) > 0 Then
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = Server.MapPath("/scripts/pca.bat") & " " & Request.QueryString("IP")
'Executor.Parameters =
Executor.ShowWindow = True
Response.Write "Attempting to execute " & Executor.Application & "<br>"
strResult = Executor.ExecuteDosApp
Response.Write "The result of this call was: " & strResult
End if
%>


I know the server creates the ASPexec object that calls the batch file. Is the batch file trying to run the pcAnywhere executable from the server and not the clients local machine? I am getting this return message written from the above code:

Attempting to execute C:\Inetpub\Scripts\pca.bat <IP Address from querystring>
The result of this call was: Access is denied.

The scripts directory has IUSR_<MachineName> setup with Read/Write/Execute permissions. The execute permissions are set to "Scripts and executables" in IIS manager. I don't know a lot about IIS so any help would be appreciated.
 
Is the batch file trying to run the pcAnywhere executable from the server and not the clients local machine?

Yes! You'll need to convert this to client side vbs in order to get pcAnywhere to load on the machine. You can also use WScript.Shell to do this over ASPExec

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Ok that's kind of what I was thinking. Now forgive my ignorance...How do I convert the above code to Client side script? Just change server.createobject to CreateObject?
 
example to the most basic form

save as a .htm
Code:
<html>
<head>
<title>run test</title>
</head>
<body>
<script language="vbscript">

    dim shell
    set shell = createobject("wscript.shell")
    shell.run "hello.bat"
    set shell = nothing

</script>
</body>
</html>

save as a .bat in the same directoy
Code:
@echo off
echo hello
pause

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
Thanks that helps a lot sorry for the long reply delay.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top