Solved

Trying to launch a program on 2012 Server from web page hosted on IIS

Posted on 2014-12-10
10
169 Views
Last Modified: 2014-12-20
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("Wscript.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
0
Comment
Question by:Gary Fuqua, CISSP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
10 Comments
 
LVL 28

Expert Comment

by:Dan McFadden
ID: 40493583
The only issue I see in the script is the WShell.Run command has a bad path reference in it.  You have:


WShell.Run "C:Jobs\doit.bat"

When it should be:

WShell.Run "C:\Jobs\doit.bat"

You are missing the slash between "C:" and "Jobs\doit.bat"

Dan
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40494005
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.
0
 
LVL 28

Accepted Solution

by:
Dan McFadden earned 500 total points
ID: 40494031
OK, then... you might want to grant IIS_IUSRS read and execute on the location of the batch file.

And make sure the identity of the Application Pool used by this web site is a member of the above group.

Dan
0
Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40495435
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.
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40495436
I tried changing the identity of the app pool to local system....nothing.
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 40510750
Did you also "grant IIS_IUSRS read and execute" permissions on that directory?
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40510980
Thanks for the reply.   Yes. That has been done already.   No luck.
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40511071
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.
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
ID: 40511097
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.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question