MSI to install and start a service

R

Russ Green

I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service after
install. How do I do that?

Thanks,
Russ
 
K

konsu

implement a Commit override in your installer class and use
ServiceController to do that.
 
P

Phil Wilson

See the MSDN Topic "Walkthrough: Creating a Windows Service Application in the
Component Designer". Maybe you already did, but that refers to a custom action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from InstallShield, Wise etc
etc, you don't need any of the above. They create the right entries in the MSI
file, ServiceInstall and ServiceControl tables, that get the Windows Installer
to do literally all of that stuff without you needing to write code).
 
R

Russ Green

Thanks for your answers guys. Did it with the following code in
ProjectInstaller.vb

Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

MyBase.OnAfterInstall(savedState)

Try

Microsoft.VisualBasic.Shell("net start IpNotifyService")

Catch ex As Exception

End Try

End Sub 'OnAfterInstall



Phil Wilson said:
See the MSDN Topic "Walkthrough: Creating a Windows Service Application in the
Component Designer". Maybe you already did, but that refers to a custom action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from InstallShield, Wise etc
etc, you don't need any of the above. They create the right entries in the MSI
file, ServiceInstall and ServiceControl tables, that get the Windows Installer
to do literally all of that stuff without you needing to write code).
--
Phil Wilson [MVP Windows Installer]
----
Russ Green said:
I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service after
install. How do I do that?

Thanks,
Russ
 
K

konsu

Is there a reason why you decided not to use the ServiceController class?

konst

Russ Green said:
Thanks for your answers guys. Did it with the following code in
ProjectInstaller.vb

Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

MyBase.OnAfterInstall(savedState)

Try

Microsoft.VisualBasic.Shell("net start IpNotifyService")

Catch ex As Exception

End Try

End Sub 'OnAfterInstall



Phil Wilson said:
See the MSDN Topic "Walkthrough: Creating a Windows Service Application
in
the
Component Designer". Maybe you already did, but that refers to a custom action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from InstallShield,
Wise
etc
etc, you don't need any of the above. They create the right entries in
the
MSI
file, ServiceInstall and ServiceControl tables, that get the Windows Installer
to do literally all of that stuff without you needing to write code).
--
Phil Wilson [MVP Windows Installer]
----
Russ Green said:
I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service after
install. How do I do that?

Thanks,
Russ
 
K

konsu

Is there a reason why you decided not to use the ServiceController class?

konst

Russ Green said:
Thanks for your answers guys. Did it with the following code in
ProjectInstaller.vb

Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

MyBase.OnAfterInstall(savedState)

Try

Microsoft.VisualBasic.Shell("net start IpNotifyService")

Catch ex As Exception

End Try

End Sub 'OnAfterInstall



Phil Wilson said:
See the MSDN Topic "Walkthrough: Creating a Windows Service Application
in
the
Component Designer". Maybe you already did, but that refers to a custom action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from InstallShield,
Wise
etc
etc, you don't need any of the above. They create the right entries in
the
MSI
file, ServiceInstall and ServiceControl tables, that get the Windows Installer
to do literally all of that stuff without you needing to write code).
--
Phil Wilson [MVP Windows Installer]
----
Russ Green said:
I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service after
install. How do I do that?

Thanks,
Russ
 
P

Phil Wilson

Interesting - I wonder if there's a command prompt screen popping up?
--
Phil Wilson [MVP Windows Installer]
----
konsu said:
Is there a reason why you decided not to use the ServiceController class?

konst

Russ Green said:
Thanks for your answers guys. Did it with the following code in
ProjectInstaller.vb

Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

MyBase.OnAfterInstall(savedState)

Try

Microsoft.VisualBasic.Shell("net start IpNotifyService")

Catch ex As Exception

End Try

End Sub 'OnAfterInstall



Phil Wilson said:
See the MSDN Topic "Walkthrough: Creating a Windows Service Application
in
the
Component Designer". Maybe you already did, but that refers to a custom action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from InstallShield,
Wise
etc
etc, you don't need any of the above. They create the right entries in
the
MSI
file, ServiceInstall and ServiceControl tables, that get the Windows Installer
to do literally all of that stuff without you needing to write code).
--
Phil Wilson [MVP Windows Installer]
----
I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service after
install. How do I do that?

Thanks,
Russ
 
R

Russ Green

Yes, a command prompt screen does popup.

Russ

Phil Wilson said:
Interesting - I wonder if there's a command prompt screen popping up?
--
Phil Wilson [MVP Windows Installer]
----
konsu said:
Is there a reason why you decided not to use the ServiceController class?

konst

Russ Green said:
Thanks for your answers guys. Did it with the following code in
ProjectInstaller.vb

Protected Overrides Sub OnAfterInstall(ByVal savedState As IDictionary)

MyBase.OnAfterInstall(savedState)

Try

Microsoft.VisualBasic.Shell("net start IpNotifyService")

Catch ex As Exception

End Try

End Sub 'OnAfterInstall



See the MSDN Topic "Walkthrough: Creating a Windows Service
Application
in
the
Component Designer". Maybe you already did, but that refers to a custom
action
that installs your service. In the Install method (override it) use
ServiceController to start it.

(If your company happens to use a commercial tool from
InstallShield,
Wise
etc
etc, you don't need any of the above. They create the right entries
in
the
MSI
file, ServiceInstall and ServiceControl tables, that get the Windows
Installer
to do literally all of that stuff without you needing to write code).
--
Phil Wilson [MVP Windows Installer]
----
I'm using a Setup Project in VB.NET 2003 Standard to install a windows
service application. I would like this installer to start the service
after
install. How do I do that?

Thanks,
Russ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top