Remote Command

Posted on 2007-08-09
Last Modified: 2013-11-05
How would I run a remote command (i.e., C:\MyModule.exe) on another Win2K3 server from an ASP page?
Question by:arichexe
    LVL 25

    Expert Comment

    you wouldn't.

    It is too much of a security risk to allow that to happen through code
    LVL 14

    Expert Comment


    I agree with @kevp75, but its not completely impossible but i would not suggest anything as to how to go about it.

    I would rather suggest you have the copy of your EXE on the server and RUN it as below...

    Set WshShell = Wscript.CreateObject ("Wscript.Shell")
    WshShell.Run "http://servername/path/executablefile.exe", 1, false
    LVL 14

    Expert Comment

    Also if you use ASPExec and try the below code then you should be able to RUN it behind(at the backdrop of windows) nothing would be visible i guess...You will need ASPExec DLL.

    You will get the same on

    Then register the dll.

    <% Response.CacheControl = "no-cache" %>>
    <% Response.AddHeader "Pragma", "no-cache" %>
    <% Response.Expires = -1 %>
      <title>Run exe file</title>
    Dim Executor
    Dim strResult
        Set Executor = Server.CreateObject("ASPExec.Execute")
        Executor.Application = "C:\WINNT\system32\Calc.exe"
        Executor.Parameters = ""
        Executor.ShowWindow = True
        Executor.TimeOut = 120
        strResult = Executor.ExecuteWinApp
    Ok, check this out<br>
    LVL 14

    Expert Comment

    If you don't get the ASPExec DLL on the site specified then search the web you should be able to get it.

    Accepted Solution

    I got rcmd to work:

    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "cmd /c net use \\MyServer\ipc$ /user:MyLogin MyPassword",,true
    WshShell.Run "cmd /c rcmd \\MyServer C:\MyModule.exe",,false
    Set WshShell = Nothing
    LVL 25

    Expert Comment

    not to make myself out to be a pessimist but, I really hope this is on an intranet that you are using this....and not a public site.

    It's not difficult to download a page and get your username and password, and wreck havok on the machine(network) this will be running on....

    just my 2c...
    LVL 25

    Expert Comment


    No objections from me
    LVL 1

    Expert Comment

    Closed, 125 points refunded.
    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now