Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Cannot uninstall Windows Service using MSI where ServiceName may be changed

Posted on 2009-04-19
Medium Priority
Last Modified: 2013-11-14
I have created a Windows Service using vb in VS 2008 where I need to have multiple versions of the service running at the same time (refer attachment). This is optional.

I have changed the Installer to accept optional Context.Parameters for the Service Name and Display Name. If I use the command line installutil to install/uninstall everything works perfectly (e.g. installutil /NAME=myService /DISPLAYNAME="my Service" myService.exe).

I have also added a Setup Project as for some customers they won't need to have multiple instances and they aren't computer savvy so command lines are a bit too much for them. There are default values in the ProjectInstaller so that when running the MSI it uses the default parameters.

The problem occus if I try and uninstall via the MSI. The Service is uninstalled but I get the first error (below). Any further attempts to install via the MSI are met with 'Preparing to remove', the same error, then the Repair/Remove screen, then the second error below. The only way to run a clean install again is to delete the Registry Entry for the MSI in HKEY_CLASSES_ROOT\Installer\Products.

 I can use the installutil /u to successfully uninstall the service without specifying a NAME parameter (after using the MSI to install).

It appears that the problem is in the uninstall where no Context.Parameters are provided.

Can anyone help??

First error:
Error 1001. An exception occured while uninstalling. This exception will be ignored and the uninstall will continue. 
However, the application might not be fully uninstalled after the uninstall is complete. 
-> Service name contains invalid characters, is empty, or is too long (max lenght = 80).
Second error:
Error 1001. An exception occured while uninstalling. This exception will be ignored and the uninstall will continue. 
However, the application might not be fully uninstalled after the uninstall is complete. 
-> The specified service does not exist as an installed service.

Open in new window

Question by:thebigo
LVL 40

Accepted Solution

Vadim Rapp earned 1500 total points
ID: 24185010
This is too involved to give detailed answer - would require to fully reproduce the problem, which is quite nontrivial for this project.

Just from the general perspective, I'd think that the way to solving this is in combining some diagnostic logging that you might put into the installer class with analyzing the log created by Installer itself. Find out if installer class is receiving the parameters during the uninstall. If it indeed does not, then probably next step is to see where they are coming from, and is that still the case during uninstall. Note that contrary to intuition, properties provided during the installation are not stored anywhere by Installer, and are not automatically available during the uninstall.

All the above is of course quite blind shot - more thorough reply would require having the project and actually trying it.

Author Closing Comment

ID: 31572132
Thanks for your response. I eventually found I had left some code in the uninstall Custom Action :(.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question