.ASP Remote Start Stop Windows Service using ASPExec
am 17.08.2007 04:57:32 von yms.yfkiFirst shot at asp... and it works like a charm.
Great server-side call from client
All I had to do is register the aspexec.dll and setup iis.. Took a few
min
----------------------------------------------------------
-ASPEXEC executes remote applications as DOS Apps or Windows
Applications.
This is how we do it ..:)
REGISTER ASPEXEC
1)move file aspexec.dll to winnt/system32 directory
2)regsrv32 aspexec.dll
***ASPEXEC DOS Commands can sometimes not work properly if Norton
antivirus "Script Blocking is enabled, only Windows commands will work
smoothly!
***Remote application will not pop up window, whether you use DOS or
windows commands, due to SP3 service pack bug.
***IF REMOTE APP IS OPEN , then use terminate on XP, or kill on 2000
Server first!! Otherwise will not work.
SERVICES
1)World Wide Web Publishing--> Allow Service To Interact With Desktop
(checked)
IIS
1) Create virtual directory
-Scripts Only
-LOW IIS Process
-Anonymous Login /Windows Integration (checked)
ASP PAGE, WEB FOLDER PERMISSIONS
Example: c:\Inetpub\wwwroot\virtualdirectory\myasppages
For DOS all you need :
Administrator -full control
Everyone-full control
For Windows add these too
Internet Guest Account(MACHINENAME/IUSR_MACHINENAME)-Read &
Execute,Read,List
REMOTE APPLICATION EXE FOLDER SECURITY/PERMISSIONS
Administrator -full control
Everyone-Read & Execute,Read,List
============================================================ =============
Here is what I use to start/stop Serv-U from any remote computer...
Start/Stop
<%
Sub startFTP()
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = "NET START"
Executor.Parameters = """Serv-U FTP Server"""
strResult = Executor.ExecuteDosApp
Response.Write "
" & strResult & ""
Set Executor = nothing
End Sub
Sub stopFTP()
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = "NET STOP"
Executor.Parameters = """Serv-U FTP Server"""
strResult = Executor.ExecuteDosApp
Response.Write "
" & strResult & ""
Set Executor = nothing
End Sub
%>
<%
If Len(Request.Form("Start_FTP")) > 0 Then
startFTP()
Else
If Len(Request.Form("Stop_FTP")) > 0 Then
stopFTP()
End If
End If
%>