How do I start/stop/create/remove/check a service?: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page.)
 
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
There are currently 5 known methods to handle services using NSIS scripting:
There are currently 6 known methods to handle services using NSIS scripting:


* Use Sunjammer's [[File:Services.zip|service control plug-in]].
* Use [[User:Sunjammer|Sunjammer's]] services plug-in: <attach>Services.zip</attach>.
* Use dselkirk's [[NSIS Service Lib]].
* Use [[User:dselkirk|dselkirk's]] [[NSIS Service Lib]].
* Use doberlec's all-in-one Swiss scripting knife - [[Nopey]].
* Use [[User:sl|sl's]] [[Service Control Manager plugin (install services and drivers on NT/2K/XP)|nsSCM]]
* Use doberlec's all-in-one Swiss scripting knife - [[Nopey - system setting_tool|Nopey]].
* Use [[User:Speed78|Speed78's]] [[NSIS Simple Service Plugin]]
* Execute the NET command (use Exec, ExecWait or nsExec).
* Execute the NET command (use Exec, ExecWait or nsExec).
* Execute your service EXE with special command line switches telling it what to do (use Exec, ExecWait or nsExec).
* Execute your service EXE with special command line switches telling it what to do (use Exec, ExecWait or nsExec).
* Execute sc.exe that comes with WinXP (C:\windows\system32\sc.exe). Also allows to define specific user account to run the service.
[[Category:Scripting FAQ]]
''Addition to Sunjammer's services plug-in to autostart services''
// in sendservicecommand.c
else if (stricmp("autostart",command) == 0)
    {
    okay = ChangeServiceConfig(hService,
      SERVICE_NO_CHANGE,SERVICE_AUTO_START,SERVICE_NO_CHANGE ,NULL,NULL,NULL,NULL,NULL,NULL,NULL );
    }
    else if (stricmp("manualstart",command) == 0)
    {
    okay = ChangeServiceConfig(hService,
      SERVICE_NO_CHANGE,SERVICE_DEMAND_START,SERVICE_NO_CHANGE ,NULL,NULL,NULL,NULL,NULL,NULL,NULL );
    }

Latest revision as of 10:39, 29 December 2014

There are currently 6 known methods to handle services using NSIS scripting:

  • Use Sunjammer's services plug-in: Services.zip (20 KB).
  • Use dselkirk's NSIS Service Lib.
  • Use sl's nsSCM
  • Use doberlec's all-in-one Swiss scripting knife - Nopey.
  • Use Speed78's NSIS Simple Service Plugin
  • Execute the NET command (use Exec, ExecWait or nsExec).
  • Execute your service EXE with special command line switches telling it what to do (use Exec, ExecWait or nsExec).
  • Execute sc.exe that comes with WinXP (C:\windows\system32\sc.exe). Also allows to define specific user account to run the service.


Addition to Sunjammer's services plug-in to autostart services

// in sendservicecommand.c
else if (stricmp("autostart",command) == 0)
   {
    okay = ChangeServiceConfig(hService,
     SERVICE_NO_CHANGE,SERVICE_AUTO_START,SERVICE_NO_CHANGE ,NULL,NULL,NULL,NULL,NULL,NULL,NULL );
   }
   else if (stricmp("manualstart",command) == 0)
   {
    okay = ChangeServiceConfig(hService,
     SERVICE_NO_CHANGE,SERVICE_DEMAND_START,SERVICE_NO_CHANGE ,NULL,NULL,NULL,NULL,NULL,NULL,NULL );
   }