• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Remote Command

How would I run a remote command (i.e., C:\MyModule.exe) on another Win2K3 server from an ASP page?
0
arichexe
Asked:
arichexe
1 Solution
 
kevp75Commented:
you wouldn't.

It is too much of a security risk to allow that to happen through code
0
 
bugs021997Commented:
@arichexe

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
0
 
bugs021997Commented:
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 http://www.serverobjects.com/products.htm

Then register the dll.


<% Response.CacheControl = "no-cache" %>>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>
<html>
<head>
  <title>Run exe file</title>
</head>
<body>
<%
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>
</body>
</html>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
bugs021997Commented:
If you don't get the ASPExec DLL on the site specified then search the web you should be able to get it.
0
 
arichexeAuthor Commented:
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
0
 
kevp75Commented:
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...
0
 
kevp75Commented:
;)

No objections from me
0
 
Vee_ModCommented:
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now