cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mahonroy
Level 3

Service Does Not Uninstall No Matter What

Hello,
I am currently working on an installer/uninstaller where its only purpose is to deploy services. I am using the premier evaluation version of Installshield Spring 2012 with Visual Studios 2012. I am doing this by using the components features in Installshield.

The service installs no problem, and remains in the stopped state. I can also use the events under the components for "Install Start" set to yes, and when the install runs, it installs the service and then runs the service (to verify the events portion is working so far). However setting the events for "Uninstall Stop" and "Uninstall Delete" to yes seem to have no effect. (It does not even stop the service, let alone delete it).

At this point, I feel I have tried everything. Doing a search on this forum for "Service Uninstall" shows numerous other threads started with users having the same problems, but there was no solution. Here is what I tried so far to get this to work.

1. Creating seperate events for the Install Start, and a seperate event for Uninstall Stop or Uninstall Delete.

2. Some user mentioned naming the components the same name as the service, so figured it was worth a shot, but this also did not work.

3. I looked through the logs and I can see that the Service Stop and Service Delete actions do occure, with a return of 1, which supposedly means that it was successfull. Refreshing the service list, closing and re-opening the service list, as well as giving the service plenty of time to stop (over ten minutes) shows that the services have not stopped or been deleted.

4. I also tried using VBScript to manually install and uninstall services through custom actions. Running the VBScript manually on my computer successfuly deploys the service, as well as stops and deletes the service. Running it through a custom action in InstallShield does nothing. Again, I can verify through the logs that the actions supposedly were executed successfully, but the services remain.

5. Since I could verify the "Install Start" was working when running install, I figured I could test it and change it to "Install Stop" or "Install Delete" (after first installing the service). Running the install like that with the service already installed should stop or delete the service, but this also did nothing.

Its almost seeming like there is some kind of a permission issue accoiated with it, but I really have no idea what the problem is, why these services can be installed and started but not stopped or uninstalled with using InstallShield.

Any help/advice would be greatly appreciated.
Labels (1)
0 Kudos
(10) Replies
rguggisberg
Level 13

I am using the Premier version of IS 2012 Spring. This has worked for me for this, and many IS versions in the past.
I have attached a file showing the settings I use in my Basic MSI project.
What are you using for a "Service Type"?
I am using "Win32 that runs in its own process".
My component settings are:
Shared "No"
Permanent "No" (Perhaps yours is "Yes"???)
0 Kudos
Mahonroy
Level 3

rguggisberg wrote:
I am using the Premier version of IS 2012 Spring. This has worked for me for this, and many IS versions in the past.
I have attached a file showing the settings I use in my Basic MSI project.
What are you using for a "Service Type"?
I am using "Win32 that runs in its own process".
My component settings are:
Shared "No"
Permanent "No" (Perhaps yours is "Yes"???)


Thanks for the reply!
I gave your recomendation a shot (My shared was "Yes" so I changed it to "No", and my Permanent was already "No"). I also changed my Events -> Key Name -> Operation Time to the same way that you had it. My Wait Type was "Wait for the event to complete" so I changed it to "Wait for the SCM".

Unfortunately this did not work either. The service installs just fine (and remains in the "stopped" state), but running the uninstall has no affect on the service.
0 Kudos
rguggisberg
Level 13

What OS are you installing/uninstalling on? If it is Vista, Windows 7/8, 2008/2012 Server or newer it may be a permissions problem.
Open a CMD prompt and type
sc stop yourservicename
If that fails with "access denied", try openin an Admin cmd prompt and repeat.
You should also be able to remove the service with
sc delete yourservicename
If it is a permissions issue, is it possible that you are installing by right clicking and doing 'Run as administrator'?
If so, then when you uninstall you don't have admin privileges.
Have you tried this on XP?
Have you tried turning off UAC? (probably not an acceptable solution... but interesting to know)
In my 'General' tab for my IS project I have "Require Administrative Privileges" set to "Yes". This takes care of the elevation.
0 Kudos
Mahonroy
Level 3

rguggisberg wrote:
What OS are you installing/uninstalling on? If it is Vista, Windows 7/8, 2008/2012 Server or newer it may be a permissions problem.
Open a CMD prompt and type
sc stop yourservicename
If that fails with "access denied", try openin an Admin cmd prompt and repeat.
You should also be able to remove the service with
sc delete yourservicename
If it is a permissions issue, is it possible that you are installing by right clicking and doing 'Run as administrator'?
If so, then when you uninstall you don't have admin privileges.
Have you tried this on XP?
Have you tried turning off UAC? (probably not an acceptable solution... but interesting to know)
In my 'General' tab for my IS project I have "Require Administrative Privileges" set to "Yes". This takes care of the elevation.


Thanks again for your reply!
I am using Windows 7 Professional, 64-bit Operating system.

I tried experimenting with sc.exe and noticed something interesting.
Opening a command prompt and attempting to stop or delete a service gives me an "access denied" error. I then opened a command prompt by right clicking and doing "Run as Administrator", then typed in "sc delete servicename" and it said "[SC] DeleteService SUCCESS", but I looked in the service manager, and sure enough it is still running. I then type in "sc stop servicename" and it displays this:

TYPE : 10 WIN32_OWN_PROCESS
STATE : 3 STOP_PENDING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

The service then is deleted from the service manager. But now everytime I try to install the service with InstallShield, it installs the service but can no longer start it (Installshield is now giving me an error 1920. Service failed to start. Verify that you have sufficient privileges to start system services.)

I also experimented with running Visual Studios by right clicking and doing "Run as Administrator", then trying the install/uninstalls, and its still not working. I verified that under "General Information" -> "Summary Information Stream" -> "Require Administrative Privileges" is set to Yes. I also tried going to "Media" -> "Releases" -> "DVD-9" -> "setup.exe" and changing "Require Execution Level" from "Invoke"r to "Administrator" and this also did nothing.

Do you have any other ideas what it could be?
0 Kudos
rguggisberg
Level 13

Well you are getting closer.
I have 'Required Execution Level' set to "Administrator" and I am pretty sure you need that.
In the General Information window I have the 'Locked-Down Permissions' set to "Traditional Windows Installer handling" - not sure if that is you problem.
Some of the rest of this we have gone over, but to summarize...
In the Setup Design Window in the General tab for that component I have 64-Bit Component "No"
Read the notes at the bottom of the window for this. You don't necessarily set this to "Yes" to run on a 64 bit system.

In the Setup Design Window in the Services tab for that component I have:
Service Type "Win32 that runs its own process"
Interact with Desktop "No"
Permissions "0 defined"

Is the logged on user an administrator when installing/uninstalling?
Can you do this outside of Visual Studio?
0 Kudos
Mahonroy
Level 3

rguggisberg wrote:
Well you are getting closer.
I have 'Required Execution Level' set to "Administrator" and I am pretty sure you need that.
In the General Information window I have the 'Locked-Down Permissions' set to "Traditional Windows Installer handling" - not sure if that is you problem.
Some of the rest of this we have gone over, but to summarize...
In the Setup Design Window in the General tab for that component I have 64-Bit Component "No"
Read the notes at the bottom of the window for this. You don't necessarily set this to "Yes" to run on a 64 bit system.

In the Setup Design Window in the Services tab for that component I have:
Service Type "Win32 that runs its own process"
Interact with Desktop "No"
Permissions "0 defined"

Is the logged on user an administrator when installing/uninstalling?
Can you do this outside of Visual Studio?


I tried out the "Locked-Down Permissions" and changing it from "Custom InstallShield handling" to "Traditional Windows Installer handling" but it didn't seem to change anything.
I also tried changing the 64-Bit Compoent from "Yes" to "No".

My Setup Design Window in the Services tab for the component was already set up like you described.

I navigated to the DVD-9 -> DiskImages -> DISK1 folder (which is what I am assiming is the correct setup.exe file to run. I ran this both by double clicking it, as well as right clicking and choosing "Run as administrator". Once it was installed, I ran the setup.exe again and it gave me the choice for repair, remove, etc. So I chose "Remove", said everything was successfull, but still was unable to stop or delete the service.

I am logged in as the administrator for the computer.
0 Kudos
rguggisberg
Level 13

You might verify the date time on the Setup.exe to make sure it is the one you think you last built.
Then log an uninstall by running following line from a command prompt. Post that here.
msiexec /uninstall {Your Product Code} /L*v Uninstall.log
0 Kudos
Mahonroy
Level 3

rguggisberg wrote:
You might verify the date time on the Setup.exe to make sure it is the one you think you last built.
Then log an uninstall by running following line from a command prompt. Post that here.
msiexec /uninstall {Your Product Code} /L*v Uninstall.log


Ok I verified the date time and this is the correct one.
The uninstall.log file was too large to upload here (6MB), so I uploaded it to a server, here is the link:

www.Jattus.com/MSIe48a8.LOG
0 Kudos
rguggisberg
Level 13

Thanks for the log. Nothing jumps out at me.
Still think it is a permissions problem.
You do know that AN Administrator is not the same as THE Administrator on Windows 7????
If you open a command prompt and the username is not Administrator... then you are not THE Administrator.
Also Windows 7 uses lesser privileges, so even if you are AN Admin or THE Admin, not everything you do is done as Admin unless you right click and 'Run as administrator'.

My suggestion would be to turn off UAC... at least temporarily as a test. If you haven't done that before... just go to Control Panel - Help - and type in UAC. Default is the 3rd level. Set to lowest level (no UAC).
0 Kudos
ISViper
Level 3

This post was so long ago, I just gave one input here since I used to run into the same problem. What I did was going to the files under the component (that you're trying to control the service) and set the service file to key file. Everything works smoothly since then. If you don't set key file (same as key path with registry key component), you may hit those random issues about start/stop services or install/uninstall keys.
0 Kudos