Executing a batch file from a web page

Hi all,

I run Win 2008 R2 on my VPS.
Occasionally I need to run a batch file. To do this I would log into the VPS and run the batch on the desktop.

However, I was wondering for an easier solution if I could do this:

On a web page that's served from the win 2008 R2 IIS machine, have a pag with a button on it, that when I click it runs the batch file on my VPS desktop?

This would save me a lot of time and I can do this as and when I need to on my smart phone.

Thanks in advance for your help.
LVL 2
oconnork00Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Hi,

Does this has to be run at random or do you have time to run this specifically? have you thought of set it up as a schedule?

You can set this as a page on your website and run from there whenever you will.

Do you know how to go about in this in IIS?

Regards
0
sumeshbnrCommented:
I don't think it is possible but somebody may help you.  

Try an another method method: use task scheduler to run this batch file

Set a scheduled task for running a batch file The batch file location can be specified in the FTP path of your desktop .(you need to setup FTP server if you don't have)

Use any FTP client and upload the file whenever you want to run .

But how you schedule the time or frequency of the scheduled task ? doubting?

make a vbscript instead of the batch file and schedule another task and say in your vbscipt to run when a batch file is available in you FTP folder.Get it ? or try any monitor and execute tools with command line option to run the batch file

or try psexec tool http://babyraj.com/add-a-network-share-to-a-users-pc-remotely-on-windows/
0
oconnork00Author Commented:
I currently use task scheduler for other tools I made. However I would much rather prefer a web based startup, if it was possible.

Thanks for the reply though.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Hi,

As  I said earlier you can implement this through your web server if this is what you wish.

Do you have a development server, configure your iis and set up a site that you want to run this script from.

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David Johnson, CD, MVPOwnerCommented:
Depends upon where you want the file to run and with what permissions?

locally (download or open the batch file from the webpage)
on the vps server, all you need is a button_click event, and in the code behind you call the batch file and it will run in the context of the current app pool identity. This 'user' must have execute permissions on that file.
0
oconnork00Author Commented:
I've no problem calling the batch file from anywhere on the VPS, but if it's easier I can run it from within the IIS folder where the initial webpage doing the "calling" would be placed.

Can you point me to some sample code for the solution you're suggesting?

Thanks
0
oconnork00Author Commented:
Depends upon where you want the file to run and with what permissions?

locally (download or open the batch file from the webpage)
on the vps server, all you need is a button_click event, and in the code behind you call the batch file and it will run in the context of the current app pool identity. This 'user' must have execute permissions on that file.

So I'd need to be logged into the VPS to do this then would I?
0
oconnork00Author Commented:
What about triggering a VBS script? Can that be done? Still stuck on this problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.