This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Instance-specific install/un-install of service
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 19, 2012
11:35 AM
Instance-specific install/un-install of service
I figured out how to prompt for a service instance name and install an instance-specific service name, similar to what SQL Server does by appending "$" and the instance name. I stored the instance name in a property called IS_SQLSERVER_SVCINSTANCE as "$MyInstance", for example. Then I made sure the service name in the tree view included [IS_SQLSERVER_SVCINSTANCE]. Indeed the service got installed with the internal name MyService$MyInstance and even had a dependency on MSSQL$MyInstance set up properly.
The problem is, when I un-install, the service doesn't go away despite the fact that I have configured it to be deleted on un-install. Did it forget the value of IS_SQLSERVER_SVCINSTANCE? Do I need to prompt for it again? Can I force it to be remembered? I thought the un-install info kept some of that kind of information around.
The problem is, when I un-install, the service doesn't go away despite the fact that I have configured it to be deleted on un-install. Did it forget the value of IS_SQLSERVER_SVCINSTANCE? Do I need to prompt for it again? Can I force it to be remembered? I thought the un-install info kept some of that kind of information around.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 19, 2012
03:19 PM
I worked out that I can use code like this in a VBScript custom action to re-establish the values of my properties on subsequent runs of the installer (works great when running a new install on a system where the service is already installed):
So I set that custom action to run after ValidateProductID. But I still don't seem to be getting the service un-installed. Do custom actions run during an un-install? I only specified it for the "Install UI Sequence", not the "Install Exec Sequence" or any of the others, but I don't see an "Uninstall Sequence". Do I need to add it to one of these other sequences?
Dim regIndex
regIndex = -1
Do
Dim name
name = Session.Installer.RegistryValue(2, "SYSTEM\CurrentControlSet\services", regIndex)
If IsNull(name) Then Exit Do
If IsEmpty(name) Then Exit Do
If Len(name) = 0 Then Exit Do
If Len(name) >= 9 And Left(name, 9) = "MyService" Then
Dim instance
instance = Mid(name, 10)
Session.Property("IS_SQLSERVER_SVCINSTANCE") = instance
If Len(instance) > 0 Then
instance = Mid(instance, 2)
End If
Session.Property("IS_SQLSERVER_INSTANCE") = instance
If Len(instance) > 0 Then
Session.Property("IS_SQLSERVER_SQLDEP") = "MSSQL$" & instance
Session.Property("IS_SQLSERVER_INSTANCETITLE") = " (" & instance & ")"
Session.Property("IS_SQLSERVER_SERVER") = "(local)\" & instance
Else
Session.Property("IS_SQLSERVER_SQLDEP") = "MSSQLSERVER"
End If
Exit Do
End If
regIndex = regIndex - 1
Loop
So I set that custom action to run after ValidateProductID. But I still don't seem to be getting the service un-installed. Do custom actions run during an un-install? I only specified it for the "Install UI Sequence", not the "Install Exec Sequence" or any of the others, but I don't see an "Uninstall Sequence". Do I need to add it to one of these other sequences?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 20, 2012
07:53 AM
Finally worked through the rest of the issue, I think. I added the custom action for loading the existing IS_SQLSERVER_SVCINSTANCE and related properties to the Install UI Sequence after ValidateProductID with the condition REMOVE <> "ALL", and added it to the Install Exec Sequence after ValidateProductID with the condition REMOVE = "ALL".
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)