Archive: Start Windows Service Automatically


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


You can invoke the windows command line tool net

netstart"servicename"

Call this via the exec or execwait command and check if the error flag is set.

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
http://technet2.microsoft.com/Window...df35f1033.mspx

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


Thanks


so what do you guys prefer to use? nsexec doing net start/stop or the services plugin? pro and cons?


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.