Gary Fuqua, CISSP
asked on
Trying to launch a program on 2012 Server from web page hosted on IIS
I'm trying to run an executable on our server when a visitor (authenticated Windows User) hits a webpage.
I have the authenticated access to the page figured out.
I have the asp page written that will be launched. The asp page displays the message "Processing Job". However, the part of the page where the batch file is launched doesn't work. The batch file never launches and the .exe in a folder on the c drive, not within the IIS web files never runs I know this must be a permission problem but I can't figure out where to set it. I had this working on my 2003 server, but upgrades have forced me to get this working on a 2012 Server.
-------------------------- ---------- ---------- ---------- --
<html>
<%
Dim WSHell
Set WSHell = Server.CreateObject("Wscri pt.Shell")
WShell.Run "C:Jobs\doit.bat"
Set WShell = Nothing
%>
<body>
<p align="Left" style="margin-top: 0; margin-bottom: 0"><font size="6">Processing Job.</font></p> ;
</body>
</html>
-------------------------- ---------- -----
Doit.bat is nothing more than a reference to an executable in the same directory. I have no problem launching the executable in the batch file running the batch file from the Server 2012 command prompt.
Any suggestions would be greatly appreciated.
Thanks
Gary
I have the authenticated access to the page figured out.
I have the asp page written that will be launched. The asp page displays the message "Processing Job". However, the part of the page where the batch file is launched doesn't work. The batch file never launches and the .exe in a folder on the c drive, not within the IIS web files never runs I know this must be a permission problem but I can't figure out where to set it. I had this working on my 2003 server, but upgrades have forced me to get this working on a 2012 Server.
--------------------------
<html>
<%
Dim WSHell
Set WSHell = Server.CreateObject("Wscri
WShell.Run "C:Jobs\doit.bat"
Set WShell = Nothing
%>
<body>
<p align="Left" style="margin-top: 0; margin-bottom: 0"><font size="6">Processing Job.</font></p>
</body>
</html>
--------------------------
Doit.bat is nothing more than a reference to an executable in the same directory. I have no problem launching the executable in the batch file running the batch file from the Server 2012 command prompt.
Any suggestions would be greatly appreciated.
Thanks
Gary
ASKER
Good eye. Unfortunately, that is just a typo in the post. The real code actually accesses a different file. I was trying to simplify things for the post.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nope.
I changed the the code slightly to try and debug
WShell.Run ("C:\Jobs\doit.bat",3,true )
Parameter "3" should open up a maximized window on server? True should wait until the command is executed to proceed.
After making this change, I get
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
I changed the the code slightly to try and debug
WShell.Run ("C:\Jobs\doit.bat",3,true
Parameter "3" should open up a maximized window on server? True should wait until the command is executed to proceed.
After making this change, I get
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
ASKER
I tried changing the identity of the app pool to local system....nothing.
Did you also "grant IIS_IUSRS read and execute" permissions on that directory?
ASKER
Thanks for the reply. Yes. That has been done already. No luck.
ASKER
I have determined that my batch file is executing by putting a simple pipe operation in the file.
dir > c:\jobs\dir.txt
The problem that I have remaining is getting the executable referenced inside the batch file, in the same directory as the batch file to execute. I wish I could echo the batch file to the screen, but that doesn't seem to work.
dir > c:\jobs\dir.txt
The problem that I have remaining is getting the executable referenced inside the batch file, in the same directory as the batch file to execute. I wish I could echo the batch file to the screen, but that doesn't seem to work.
ASKER
Getting closer...
I used the pipe option to output the results of my batch file execution
WShell.Run "C:Jobs\doit.bat >> c:\Jobs\doitresults.txt"
The results showed the the executable is running, The parameters that I am passing to it are bad.
I used the pipe option to output the results of my batch file execution
WShell.Run "C:Jobs\doit.bat >> c:\Jobs\doitresults.txt"
The results showed the the executable is running, The parameters that I am passing to it are bad.
When it should be:
WShell.Run "C:\Jobs\doit.bat"
You are missing the slash between "C:" and "Jobs\doit.bat"
Dan