Avatar of oconnork00
oconnork00Flag for United States of America

asked on 

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.
Microsoft IIS Web Server

Avatar of undefined
Last Comment
oconnork00
Avatar of Emmanuel Adebayo
Emmanuel Adebayo
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of Sumesh BNR
Sumesh BNR
Flag of India image

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/
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel Adebayo
Emmanuel Adebayo
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
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.
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

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
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

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?
Avatar of oconnork00
oconnork00
Flag of United States of America image

ASKER

What about triggering a VBS script? Can that be done? Still stuck on this problem.
Microsoft IIS Web Server
Microsoft IIS Web Server

IIS is Internet Information Services, the web server included with Windows Server operating systems. All current versions are built on a modular architecture; modules can be added or removed individually so that those required for specific functionality are installed. The full installation of IIS includes HTTP, security, content, compression, caching, logging and diagnostics.

36K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo