PDA

View Full Version : Install MSDE, Start Services, Run SQL Sript



Publik2
06-08-2005, 08:50 PM
Hi

I have selected the MS SQL Server 2000 Desktop Engine (MSDE 2000) Setup prerequisite and that installs fine, but my question is, with a basic msi project how do I after I have installed MSDE, Start the MSSQLSERVER and SQLSERVERAGENT services.

I want to do this because during the install I run an SQL script to setup the database and these services must be running for the script to work.

I have read that this has been a problem for a lot of people, I also read an IS tech say that they would release a setup prerequisite or mm that would start those services.

I cant find any options with the MSDE prerequisite to start those services.

Do I have to use an Install Script project to start these services?

Is there an easy solution to this problem?

ANY help would be really appreciated

Thanks in advance :D

sebastien Praly
06-14-2005, 11:14 AM
Did you ever find how to start the service? I'd like to know how to do that since I just started including MSDE in my install and having to start it manualy.

Drookue
06-14-2005, 11:58 AM
ServiceStartService ( szServiceName, szStartServiceArgs );

dotnetandrew
06-14-2005, 12:02 PM
This is pretty easy to do.

Add a component to your project, called whatever you want. Link it to the same feature that the MSDE object is linked to.

Expand the component - > Advanced Settings -> Control NT Services

Add a node called "MSSQLServer$[InstanceName]" where "[InstanceName]" is the instance name you chose in the MSDE object wizard.

Set the InstallStart property on the new node to "Yes".

Andrew Elmhorst
SR Software Engineer
Edustructures, LLC

Publik2
06-14-2005, 07:42 PM
DotNetAndrew:
Is that for installscript projects only? because I am using a basic MSI project, I am not sure where to specify the instance name for MSDE but I guess it is set to default which is the computer name. But I have looked into starting an NT service like that before, but then you have to get StartService standard action to run in the right place in the install BEFORE i run my sql script.

I sucessfullly implemented Drookues method in an install script (basic MSI project so it was implemented as a custom action) by using the function: ServicesStartService () and that actually worked. However once again when scheduling it I put it as <First Action> in the UI sequence so it ran before my SQL script did. However what happened was it would install MSDE prerequisite and then all UI would disappear while it started MSSQLSERVER and SQLSERVERAGENT and then after some wait it would show the welcome screen. Obviously this is not best because the user is like What the hell ? did the install just stop or crash? theres no screen? You cant expect a user to wait around with no UI for a minute or something.

Does anyone have sugesstions as to how to schedule this action?

sebastien Praly
06-22-2005, 07:45 PM
That is a promising solution. I tried it but being a component, the default sequence is too late. I have the default SQL login screen coming up, and the service is not started at that point. I'm trying to figure out how to delay this login screen so that it can copy and install the components first before running the sql scripts, hoping that the component will start the service.

sebastien Praly
06-22-2005, 07:47 PM
Droukue:

Do have an example of of the argument for the second parameter?

Publik2
06-23-2005, 08:08 PM
I am using a basic MSI project, so that means i can use install script and then put that install script into a custom action. So put the below code into install script.

ServiceStartService ("MSSQLSERVER","")
ServiceStartService ("SQLSERVERAGENT","")

Then I went to add a custom action and follwed the custom action wizard, selecting the option to execute Install Script - obviously executing the function that contained the above code. Then I left the rest of the options as defualt. I then went to sequences and I inserted the custom action I just created. I place it right before InstallWelcome (Installation - User Interface Sequence). This worked for me, the services started while the welcome screen was disabled in the background. Then when everything was finished the welcome screen was enabled and the services had started before the SQL login screen.

The only thing I want to do now is have a message come up while the services are starting saying "Installation is being setup, this make take some time, please wait ..." Because starting those services takes a while and I dont want to use a MessageBox because I dont want the user to have to hit OK, I just want them to know it takes a while. So I'm not sure which dialog that is, and how to get it to pop up and disappear.

coreuml
07-20-2005, 08:37 AM
This is pretty easy to do.

Add a component to your project, called whatever you want. Link it to the same feature that the MSDE object is linked to.

Expand the component - > Advanced Settings -> Control NT Services

Add a node called "MSSQLServer$[InstanceName]" where "[InstanceName]" is the instance name you chose in the MSDE object wizard.

Set the InstallStart property on the new node to "Yes".

Andrew Elmhorst
SR Software Engineer
Edustructures, LLC

Add a node called "MSSQL$[InstanceName]" where "[InstanceName]" is the instance name you chose in the MSDE object wizard

Peter Kosenko
03-05-2008, 06:58 PM
I notice that where I used to have "MSSQLServer$[InstanceName]" on my computer, I now have "SQLAgent$[InstanceName]", probably because I added SQL Server to my machine? So the name is not guaranteed and you would need to test for variants of it with ServiceExistsService ( szServiceName );



This is pretty easy to do.

Add a component to your project, called whatever you want. Link it to the same feature that the MSDE object is linked to.

Expand the component - > Advanced Settings -> Control NT Services

Add a node called "MSSQLServer$[InstanceName]" where "[InstanceName]" is the instance name you chose in the MSDE object wizard.

Set the InstallStart property on the new node to "Yes".

Andrew Elmhorst
SR Software Engineer
Edustructures, LLC

Peter Kosenko
03-06-2008, 10:50 PM
Actually, it is more complex than this.

The properties for "SQLAgent$[InstanceName]" show that it "depends" on an underlying "MSSQL$[InstanceName], which makes things a little confusing.

However "MSSQL$" is no longer visible in the service pane.

Can you start EITHER ONE and get the same effect, or should you start the underlying service?

I quess I'll find out.


I notice that where I used to have "MSSQL$[InstanceName]" on my computer, I now have "SQLAgent$[InstanceName]", probably because I added SQL Server to my machine? So the name is not guaranteed and you would need to test for variants of it with ServiceExistsService ( szServiceName );