Skip to content
⌘ NSIS Forum Archive

Start Windows Service Automatically

6 posts

lmenaria#

Start Windows Service Automatically

Hello everyone,

I have created a windows service using NSIS script and Installed it, It has AUTO option, I want to Start Automatically while Installation in Done, without restart Machine or Manual Start.

Pls Suggest me
thanks
LM
flizebogen#
You can invoke the windows command line tool net

net start "servicename" 
Call this via the exec or execwait command and check if the error flag is set.
Brummelchen#
net start
and
net use
are your friends.
but be aware that the settings of service allow to stop it.
some services were set in all 3 failures to restart again
- they are unstopable

try to set their behaviour from atuomatic to manual/disabled before

read


it is something like
sc config <service> start= disabled
or
sc config <service> start= demand

# in german
http://www.microsoft.com/technet/pro....mspx?mfr=true
Yathosho#
so what do you guys prefer to use? nsexec doing net start/stop or the services plugin? pro and cons?
kichik#
A plug-in, which in turn uses a documented API, is the best option in my opinion. net.exe is a user-end tool, which may not exist on all systems and may change its interface over versions. On the other end, net.exe is simpler to use than API. But the plug-ins should solve that by providing their own documented interface above the API.