Repairing an existing running service.

Got a problem you cannot solve? Try here.
Post Reply
Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Repairing an existing running service.

Post by Frank »

I've got product installed as a service and I was wondering about the following scenario:
1. The installed (Windows) service is running.
2. The user decides repair the installation.
3. InstallAware does upgrade.

However, I forget to stop the service prior to repairing, this means the file (executable) is locked. You can't delete it or modify.
InstallAware doesn't seem to mind since the repair goes without at problem.
After the repair, a reboot is requested.

Is that reboot necessary because some files were locked?
And are these files replaced with the 'repaired' ones during the reboot?
Or should I stop the service while repairing and start it afterwards (saving a reboot)?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Repairing an existing running service.

Post by FrancescoT »

Dear Frank,

you should "Always" stop the service before to execute any operation over the service file.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Frank
Posts: 59
Joined: Tue Oct 27, 2009 9:16 am
Location: Netherland

Re: Repairing an existing running service.

Post by Frank »

OK, clear answer. I assumed that much already, but do you perhaps know if Windows (MSI) can circumvent a locked file by requesting a reboot and then replace the file when the system restarts?
This is just me being curious, your answer will get me going so thanks for that!

One more question: The stopping of this service during a repair can that be done with "Control Service ServiceName: stop on uninstall" or should I call Run Program "sc.exe stop ServiceName"?
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Repairing an existing running service.

Post by bokkie »

Frank,

I've used both with equal success. Sometimes a mix of both work well together. That is, I'd use net stop as it just seems more "tactile" if you get my meaning and then use the IA commands to do the service teardown.

Then again, if you create your services with TopShelf it becomes easier still. :wink:
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
mwilner
Posts: 88
Joined: Fri Sep 18, 2009 5:55 am

Re: Repairing an existing running service.

Post by mwilner »

@bokkie
How did you overcome the problem that Run Program is not passing on the elevated status and a net call without admin elevation will fail.
Best regards,
Manfred Wilner
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Re: Repairing an existing running service.

Post by bokkie »

Manfred,

I've never done anything special when installing services. I tested them on my local machines first and then the installation media was given to the sys admins. The sys admins ran the installations on the production servers so they probably had the necessary elevations and privileges. These days, I create all my services with TopShelf's factory assembly. The sys admins continued to install the application and assemblies and I gave them the simple DOS command to install and uninstall the service; effectively giving them full control.

I know I've beaten the TopShelf drum many times but for service development it's really very good.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
Post Reply