Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

SQL Server Service


2 replies to this topic

Vaibhav.Goel

Vaibhav.Goel
  • Members
  • 11 posts

Posted 24 May 2006 - 05:48

Hi,

I am working on a Installation which requires the MS SQL Server 2000 service to be started if its not running or if its already running then it needs to be restarted. To achieve this I first get the MS SQL server service state using the "ServiceGetServiceState" function and then stop the service using the "ServiceStopService" function and then start it using "ServiceStartService" function. But sometimes this function does not work. It returns without starting the service. To overcome this problem I added these functions in a while loop waiting for 2 secs after executing "ServiceStartService" and then checking the Service State to see if it has been started. This solved my problem but then a strange problem started occuring. On some machines while executing the "ServiceStartService" in a loop the service never starts. The service status keeps on alternating between Starting and Stopped. This occurs on very few machines. While trying to figure out a solution I found that the problem occured on only those machines that were connected to a network cable. The problem got resolved automatically as soon as the network cable was detached from the machine.
I would like to know that why is this problem occuring. Why is the "ServiceStartService" function not working correctly when a machine is connected to a network?
I have already checked that the "ServiceStartService" function is not returning any error.

Thanks,
Vaibhav

cfellas

cfellas
  • Members
  • 3 posts

Posted 24 May 2006 - 19:11

I have used the following with no issues,

set ShellObject = CreateObject("Shell.Application");
bReturn = ShellObject .ServiceStart("SERVICENAME", true);
set ShellObject = NOTHING;

DELAY -


set ShellObject = CreateObject("Shell.Application");
bIsRunning = ShellObject.IsServiceRunning("SERVICENAME");
set ShellObject = NOTHING;
if (bIsRunning = FALSE) then
DELAY and Maybe check again

Chris Fellas[br]Software Configuration Engineer[br]SPSS

Vaibhav.Goel

Vaibhav.Goel
  • Members
  • 11 posts

Posted 26 May 2006 - 05:02

Hi cfellas,

I tried using the code that you provided but it is giving some error. Can you please tell me what exactly is Shell.Application
There are no such functions as ServiceStart and IsServiceRunning. Am i missing any reference and would it be different if I mention that I am using Installshield 11 premier edition?

Thanks,

Vaibhav