0

Let me describe the scenario

It is suppose to be intranet site

I have created in mvc web application which i have hosted on some server. The site gives a login page when you enter your credentials they are used to get data from an xml file on server. If you do not have access to the server it you are not able to login

After login there is page which displays details from that file and run cmd When i searched i found that user has to give some permissions iis does not run cmd on user machine. My main motive is for user to run a command in cmd. I don't want user to open cmd and run it. Due to which i have given the link in site to run cmd

I have tried some of the solutions on following links When i try this it works on local machine but not when i publish on some server and This gives permission issue when run on IE browser and on other browsers it does not work

Is there any alternate way to run the cmd because may be 1 user can give the permission but not hundreds.

I have tried running JavaScript to run a simple command for test purpose. I face the following error.

This is when i ran in Google browser. It is happening because ActiveXControl only works for IE browser but i want it to run on all browsers any suggestions This is when i ran in Google browser

This is when i ran in IE browser. This is when i ran in IE browser

I tried with simple html page as well it run normally but when i host it on local IIS it does not work and no error is shown, nothing happens.

What am i trying to do ?

I want to create a site which will have a link to upgrade windows. To upgrade windows i am using MDT tool to deploy the task sequence, there is a VB script called LiteTouch.vb which is on the server on which MDT is installed. I need to run this file on client computer. To run the file i was running cmd on client computer and command i was running was cmd /c cscript \10.2.0.180\MyShare1\Scripts\LiteTouch.vbs /TaskSequenceID:TS001

Edited I tried to let user download a batch file which world run the commands but i need it to be run automatically without user running it. Is there some way to run it through my site.

I also tried to store my bat file on network drive H:/command.bat and then run it using the solution given in Here but it says cannot find the file file:///H/Command.bat

Sushant Baweja
  • 202
  • 1
  • 5
  • 14
  • Im glad it doesnt run on the user machine - imagine if every website could delete and copy off all your stuff – BugFinder Apr 20 '18 at 06:26
  • 1
    What code have you tried so far? What error do you get when you run it? – Nick.Mc Apr 20 '18 at 06:30
  • :) It is an intranet site and I just edited what all i have tried – Sushant Baweja Apr 20 '18 at 07:21
  • If you want to run things on the _client_ (the computer with the web browser), you use Javascript (but you can't do much, with good reason). If you want to run something on the web server, you run it with you server code (C#). Please explain which one you want to do then actually post the error that you get. – Nick.Mc Apr 23 '18 at 01:23
  • YOu are not going to be able to run CMD on the client / browser side using javascript. That kind of thing was disabled long ago for security reasons. What are you actually trying to do? Have you worked out whether you want to do it on the client or server yet? – Nick.Mc Apr 24 '18 at 00:08
  • I have just edited and added what i wanted to do – Sushant Baweja Apr 24 '18 at 03:50
  • That is going to run under the context of the logged in user. If the user is not an admin you'll probably have issues. If that's not a problem, then you just need to provide URL to a `CMD` file containing that batch script, with instructions to the end user that they should run it regardless of any security warnings. Browser are specifically set up to stop this kind of thing happening to stop viruses etc. so there will be a lot of warnings and prompts before they can run it – Nick.Mc Apr 24 '18 at 04:14
  • This is exactly what you want: https://stackoverflow.com/questions/18980957/is-it-possible-to-run-an-exe-or-bat-file-on-onclick-in-html – Nick.Mc Apr 24 '18 at 04:15
  • I have edited and add at the end for what i tried – Sushant Baweja Apr 26 '18 at 12:52
  • That's a standard security measure. There's a good reason that you can't run a CMD on your local machine without answering a prompt - it's a security issue. There's no way around it. And again: YOu'll probably find the user does not have sufficient rights – Nick.Mc Apr 29 '18 at 11:00

0 Answers0