Installshield not stopping service during minor upgrade - service

In my installer I have a component that installs an NT service. I have a problem that during minor upgrade the service is not stopped. I observed the log generate by installshield during upgrade and it reports it is doing the action StopServices and its return code is 1. I have also started process hacker to log for services start/stop events but the service is never stopped during upgrade. I have also verified that during uninstall the service in stopped and then removed. Any idea why this is happening?
I am using installshield 2008, but any installshield related answer will be really helpful.

Eventually I was not able to overcome this issue. Spent several days trying to figure out what exactly is going on and was not able to figure out why the service is neither stopped nor started during minor upgrade. I was forced to write custom actions that perform this operations and used sc.exe for them. This is not the first unsolvable issue in installshield that I was forced to fix with a custom action. Hope this answer will save several days to someone.

It can be done by install script and a custom action that executes it.
An example for stopping/starting a service (i used it in IS2016):
#include "ifx.h"
//Function to stop the service
export prototype stopService(HWND);
function stopService(hMSI)
begin
ServiceStopService ( "my service name" );
end;
//Function to start the service
export prototype startService(HWND);
function startService(hMSI)
begin
ServiceStartService ( "my service name" ,"");
end;
In order to run the custom action during minor upgrade only, set its condition to:
REINSTALLMODE=vomus

Related

Rollback Service installation in unattended mode with install4j

I'm trying to create an Install4j updater in unattended mode using Stand Alone Update Downloader and invoke it using the api. (this is working)
The application is a Windows Service and it opens http ports.
I would like to be able to rollback to the previous installed service if the new installed version isn't working. There should be no user interaction to do it.
What I was planning to do is:
Install the service
Start the service
Call Wait for Http Server Action that calls an Url of the service to check if my new updated service is working as intended.
If it doesn't returns a 2xx it will initiate the rollback process
But what I'm seeing is that the rollback process starts but it stops and uninstalls the new service but the previous service is never reinstalled.
What I would want it to do when rollbacking is:
Stop the new service
Uninstall it
Rollback any other files added by the new version
Reinstall the previous service
Start the previous service
Is there any way to achieve it ?
Edit:
I have those actions in the installer:
In this version of Install4j (10.0.4) the rollback mechanism doesn't handle this scenario. As specified by the comment of Ingo Kegel this will be improved in further version.
What is working with this version is that:
Add the condition on Install service to not to run it when updating like this: !context.isUpdateInstallation(). There will no rollback of the service when updating.
To keep the service started, we added a Stop a Service at the beginning. This way if there's a rollback, the Stop a Service will be rollbacked, so it will restart the service.

Unable to start service in window 10 by using NSSM

I have create a small script file to test.
This my script.bat file.
sc create myService binpath= C:\Users\Admin\Desktop\test.bat start= auto
This is my test.bat file.
echo "Welcome to Wizard"
Problem Statement
I am unable to start the service from control panel Service section.
I get following error.
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
That is why I am using nssm.
NOW what happening is that when I run following command on powershell
.\nssm install myService, I dialogue box appears. I give it the path of my script file and click on install service.
After successfull installation of service. I go to control panel -> Service -> click on start against myService but it get paused and following dialog box appears
How can I fix this?
Is there anyother way to do it without doing manual steps and not using third party tool.
I am doing all this on window 10. Do I need any server to perform this task?
NOTE: I cannot use Always up or window scheduler in my case.
The NSSM behaviour is caused by the script terminating almost instantly. Try the following script:
echo Hello World
pause
This should allow the service to start, but you will not necessarily see a console window. Even if you tick 'allow service to interact with desktop', it will not be your desktop that it interacts with!
Windows implements 'session zero isolation' as a security feature, and this essentially prevents services interacting with end user desktops.
In terms of a solution, it's possible to write Windows 'service' applications fairly simply using Visual Studio. It's outside my area of expertise, but based on the Windows applications I'm familiar with, you would generally have a user-mode application running to provide desktop interaction. The user-mode application can interact with services hosted by the service application.
Probably this is resolved by now, but in case it helps anyone, what saved the day for me was checking again my input in the arguments field in nssm. I had an extra "-" which created the error. To edit my service, I went via nssm edit <servicename>
I would also add on the fix that worked for me. I added "" (quotes) in the argument path and that solved the issue for me.

Rebuild indexes on InvokeSBFarmUpgrade

I have recently followed the steps of upgrading Service Bus 1.0 to Service Bus 1.1. I am at the step were I am using PowerShell to run "Invoke-SBFarmUpgrade" and the commandlet is failing with:
Invoke-SBFarmUpgrade : Upgrade encountered an exception in upgrade_GatewayDatabase_2.13.0.0_1.7.81.0: Online index operations can only be
performed in Enterprise edition of SQL Server.
I don't see an option in the common parameters to be able to set the rebuild option to offline. How can I get over this hurdle?
If this isn't possible, can I create a new Service Bus Farm using the configuration wizard and reattach the Workflow manager to the new farm?
Any help would be appreciated. I'm stuck
Open C:\Program Files\Service Bus\1.1\CommonGatewayStoreUpgrade.sql and replace ONLINE = ON with ONLINE = OFF.
Now you can run Invoke-SBFarmUpgrade and it will work.
(It's probably a good idea to undo your changes to the *.sql script afterwards)

Wix Uninstall service issue

So basically what I'm trying to do is to have a number of additional parameters (namely SERVICENAME and SERVICEDISPLAYNAME) in the installer of my application (which runs a service) instead of hard-coding them in the installer. The installation runs fine with this change. However the problem I have is when I run a silent uninstall. It appears that the Service Control does not stop the service before removing it from the machine and I get a dialog box telling me that the service is still running and asking me if I want the service to be stopped before uninstalling it. What should I do to make it work (i.e. make the service control to stop the service automatically before removing it)?
The ServiceControl Element is just an abstraction for the underlying ServiceControl Table. Neither "do" anything. Instead, they merely express what needs to be done. The stopping of services is performed by the StopServices Action which gets it's orders from the aforementioned table.
In Windows Installer, properties are not persisted automatically after an installation is complete. If you log the installer you will likely find that your SERVICENAME property is null and the StopServices action doesn't know what to do with that.
Take a look at the following:
The WiX toolset's "Remember Property" pattern
If you implement this pattern, the data for SERVICENAME should be restored during the uninstall and the

"Cannot uninstall Language Pack 0 because it is not deployed" when attempting to uninstall-spsolution on sharepoint 2010 foundation

I continue to get this error message "Cannot uninstall Language Pack 0 because it is not deployed" when running the uninstall-spsolution cmdlet. I've attempted a number of alternate syntaxes to no avail. (tried add -language 1033 for example) I see a few other similar issues on the web, but nothing specifically addressing my issue. I know the solution exists. not sure why the Language Pack issue is arising. (by the way...i can see my solution using Sharepoint manager 2010). I've tried a number of anyway, any help would be appreciated. thanks.
(Note: was unable to upload image of error from powershell command shell due to site restriction).
I'm also seeing this error in one of our farms when I run the Update-SPSolution commandlet. Recently, we updated the farm with foundation and server Service Pack 1, the associated server language packs and the June Cumulative update. By chance, is this the patch level of your farm? Interestingly, I have no trouble running Update-SPSolution in another farm patched to the same level. The bottom-line is that I don't think this is limited to Uninstall-SPSolution or Update-SPSolution.
I just resolved the issue by doing the following:
Checked the solution store and saw that the solution I was updating was not deployed
I attempted to deploy the solution and saw that it was stuck in the deployment stage
From services.msc I stopped and restarted the SharePoint 2010 Timer service and the SharePoint 2010 Administration service. I don't normally stop and start SharePoint services from Services, but that seemed to do the trick. I also don't know whether it's necessary to recycle both of these services.
I then returned to the command line and was able to successfully update the solution.
Please let me know if this works for you.
While I like the answer above and I think it would work some of the time, in my case I had to remove the Errored out WSP from the solution store and then re-add it and then install/deploy it again. After that my updates were working fine again.
I had the same issue, I opened the manage solutions in central admin and there was an error message next to my solution. The error message was actually helpful, it directed me to solve the issue. I have added -force while installing the solution using power shell command then it worked fine.
After that I deactivated and reactivated the feature just in case.
I've got the same problem and restarting the services was not enough for me.
Then, I solved doing:
Retract and then Remove of the wsp from: Central Administration–>System Settings–> Manage farm solutions.
Then, from Powershell, I have canceled the Features with null scope (which were preventing me to install again the package succesfully):
Get-SPFeature | ? { $_.Scope -eq $null }
$feature = Get-SPFeature | ? { $_.Scope -eq $null }
$feature.Delete()
And at the end I have installed again the wsp:
Add-SPSolution -LiteralPath Path
Install-SPSolution -Identity Name.wsp -WebApplication WebApplicationPath –GACDeployment
Then it worked :)
Update: I've just got this problem again, but this time there weren't features with null scope, so it has been enough just to add -Force while installing the wsp.
I had the same issue and after redeploying solution it's gone.