Archive: How to stop the service in the NSIS?

How to stop the service in the NSIS?
I have created exe file successfully.In my application running both ways silent and non-silent mode.Also i have included Repair and Remove features also.I have tried following code,

Function .oninit
!ifdef IsSilent
SetSilent silent
StrCpy $Value "silent"

Function check
${If} $Value == "silent"
---stop the service

If the user run second time in non-silent mode i want to the stop the services.but its not working in the above code.both cases silent and non-silent mode the service was stopped.that is if condition was not working.Also i have got following warning.
Variable "Value" not referenced or never set, wasting memory!
I have assigned value.but then why this warning show up?

You are mixing compile time and run time. There is no need for a variable either, just use IfSilent but having a difference like this between silent and non-silent does not make sense IMHO (And remember, the user can use /S to activate silent mode)