473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to reboot at end of deployment

My deployment contains sevral projects, one of which is a service. The
installation does not automatically carry out a reboot at the end of the
installation process, which is required to start the service. Is there any
way I can put something into the deplyment project to make the target system
reboot at the end of the setup?
--
Dave
May 18 '06 #1
14 1903
You will have to restort to WinApi and pinvoke.

There is an example in MSDN at :

ms-help://MS.MSDNQTR.2005APR.1033/sysinfo/base/how_to_shut_down_the_system.htm

Regards,
Tasos

May 18 '06 #2
Thanks Tasos, but your link didn't work. Perhaps I should have mentioned that
I am using VS2003.
--
Dave
"Tasos Vogiatzoglou" wrote:
You will have to restort to WinApi and pinvoke.

There is an example in MSDN at :

ms-help://MS.MSDNQTR.2005APR.1033/sysinfo/base/how_to_shut_down_the_system.htm

Regards,
Tasos

May 18 '06 #3
Hello Dave,

Here http://msdn.microsoft.com/library/de...the_system.asp

D> Thanks Tasos, but your link didn't work. Perhaps I should have
D> mentioned that I am using VS2003.
D>
D> "Tasos Vogiatzoglou" wrote:
D>
You will have to restort to WinApi and pinvoke.

There is an example in MSDN at :

ms-help://MS.MSDNQTR.2005APR.1033/sysinfo/base/how_to_shut_down_the_s
ystem.htm

Regards,
Tasos

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 18 '06 #4
> My deployment contains sevral projects, one of which is a service. The
installation does not automatically carry out a reboot at the end of the
installation process, which is required to start the service. Is there any
way I can put something into the deplyment project to make the target system
reboot at the end of the setup?


Pop up a dialog that says "You need to reboot" :)

I would have the service start without the reboot.

May 18 '06 #5
Wow. But perhaps "Displaying the Shutdown Dialog Box" (two subjects lower) is
more user-friendly?
May 18 '06 #6
Thanks Michael and Piebald for both those references , however they are not
exactly easy to pop into my deployment project. I presume I have to write a
program to do it, and then call it as a Custom Action in the deployment
project, is that the idea?
--
Dave
"PIEBALD" wrote:
Wow. But perhaps "Displaying the Shutdown Dialog Box" (two subjects lower) is
more user-friendly?

May 18 '06 #7
So would I. Do you know how to make the deployment project do that?
--
Dave
"PIEBALD" wrote:
My deployment contains sevral projects, one of which is a service. The
installation does not automatically carry out a reboot at the end of the
installation process, which is required to start the service. Is there any
way I can put something into the deplyment project to make the target system
reboot at the end of the setup?


Pop up a dialog that says "You need to reboot" :)

I would have the service start without the reboot.

May 18 '06 #8
Hello PIEBALD,

P> Wow. But perhaps "Displaying the Shutdown Dialog Box" (two subjects
P> lower) is more user-friendly?

Sure. Because user, not you decided when restart system :)

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 18 '06 #9
> So would I. Do you know how to make the deployment project do that?

Well, I've never done it, I haven't fiddled with custom actions yet either.

But I _have_ written a service, which resides in an EXE which can take
command-line parameters to do such things. The code I have is pretty
convoluted, but look into:

System.ServiceProcess.ServiceController svc = new
System.ServiceProcess.ServiceController
(
"ServiceName"
) ;

if ( ( svc.Status != System.ServiceProcess.ServiceControllerStatus.Runn ing )
&&
( svc.Status != System.ServiceProcess.ServiceControllerStatus.Star tPending ) )
{
svc.Start() ;
svc.WaitForStatus (
System.ServiceProcess.ServiceControllerStatus.Runn ing ) ;
}

You could probably write a simple program that simply does that and have the
custom action run it.
May 18 '06 #10
You don't need to force a reboot to start the service. You can use WMI
to start the service programmatically via a custom action.

May 18 '06 #11
Well, I'll try that. I was hoping Visual Studio might be a bit more helpful.
You don't have any more details do you?
--
Dave
"Andy" wrote:
You don't need to force a reboot to start the service. You can use WMI
to start the service programmatically via a custom action.

May 23 '06 #12
Check out this post:
http://groups.google.com/group/micro...f914cabbec1593

HTH
Andy

May 23 '06 #13
Oh, it dosen't use WMI, I was mistaken about that part.

You'd put that code inside an installer class, which is part of your
appilcation assembly.

See InstallerBase for some details on that.

You then add a custom action; the custom action should be the primary
output of your application.

May 23 '06 #14
Ha. It is so easy when you know how. That article gave me the clue. Thanks.
Just override the Commit method in the Installer derived class, instantiate a
ServiceController with the name of the service and call Start(). Works like a
charm (which is more than can be said for these newsgroups - am I the only
one that has to click the "read the response" link 20 times before I get it?)
--
Dave
"Andy" wrote:
Oh, it dosen't use WMI, I was mistaken about that part.

You'd put that code inside an installer class, which is part of your
appilcation assembly.

See InstallerBase for some details on that.

You then add a custom action; the custom action should be the primary
output of your application.

Jun 4 '06 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ben Allen | last post by:
Is there a way (through a variable) to show the date of the last server reboot i.e. when PHP last started running? As I am trying to show the server uptime, which of course only works from the last...
5
by: ray well | last post by:
hi, are reboots needed after installing mdac ? are reboots needed after installing .net framework? i'm planning out an install, and need to know what to expect. thanks,
4
by: Urs Vogel | last post by:
Hi I deploy a Windows Service which requires a reboot after setup. The setup project, however, does not automatically recognize this requirement.How do I force a reboot (or set a reboot...
1
by: Aaron | last post by:
Not sure if this is the best spot to post this question, but I am not going to pay money to ask an installation question.... Anyways I am trying to install C# standard 2003 and it analyzes the...
1
by: PhilBray | last post by:
Hi, I am currently adding a deployment project to my C# solution which installs a windows service and I have been trying to find a property that will make the installer prompt the user to reboot...
3
by: iamsiju | last post by:
Hi, I am facing a problem with the Perl Telnet Object. My Telnet Object hangs just after issueing reboot command on the remote host. Please help me who faced this problem !!! Thanks in...
3
by: gnih | last post by:
Hi, I'm using VS2005 and .net 2.0, my project using Windows Installer deployment to make setup package. the question is how can i invoke a dialog let user choose reboot or not at the end of...
2
by: =?Utf-8?B?VHJhY2tz?= | last post by:
When I run my setup of a vb.net app made in VS2005 and setup made with the setup wizard and then modified in the ide, The .net 2 setup runs and installs and then asks to reboot. If you answer ok...
3
by: cj | last post by:
My program shuts itself down and reboots the pc it's running on at 2:00am twice a week and has been doing so without fail for over a year. But twice in the past month it's been found running in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.