During uninstall progress, the installer displays below message:
"The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup."
I think it's caused by the installed service is still running while uninstalling. So, I try to write a custom action to stop it. But, it seems not work.
If I set the action as Execute='deferred' Impersonate='no', it only allows me to put action between InstallInitialize and InstallFinalize, so I have to set it as "immediate".
<CustomAction BinaryKey='CustomActions' Id='StopService' DllEntry='StopService' Execute='immediate' />
<Custom Action="StopService" Before="InstallValidate">REMOVE="ALL"</Custom>
Also note that, I have to use custom action to install service manually instead of using Wix by some reasons. That's why I'm trying to remove it manually.
You cannot run an elevated custom action before InstallInitialize. If you were to install the service normally, MSI would take care of stopping the service for you and not show the in-use message.
Related
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.
I am implementing silent upgrade using "Updater without version check" of install4j. After finishing silent upgrade I dont want to reboot machine in any scenario.
So I am passing parameter "-Dinstall4j.suppressUnattendedReboot=true" via ""Set installer arguments" action. Now I want to test whether is working or not? Is there any way to verify this parameter is passed to installer? And force reboot in between update and check this parameter actually suppressed reboot?
Is there any way to verify this parameter is passed to installer?
In a "Run script" action, you can check
Boolean.getBoolean("install4j.suppressUnattendedReboot")
and check this parameter actually suppressed reboot?
For testing, you can force the installer to reboot by adding the "Reboot computer" action. The -Dinstall4j.suppressUnattendedReboot=true argument will then prevent the reboot from happening.
I'm keeping the "Log On As" info on upgrade for the service I'm installing.
<InstallServices>NOT WIX_UPGRADE_DETECTED</InstallServices>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
However, the upgrade fails if the user/password are incorrect.
How can I allow my service to fail to start?
I'm able to do this by adding
<ServicesStart>0<ServicesStart>
and using a custom action to start the services. Although it works, I don't quite like it.
The custom action simply runs a batch file with the following line:
net start FoobarService
I use quiet execution in the MSI, but running this batch file from the command line I have the following output:
System error 1069 has occurred.
The service did not start due to a log-on failure.
That's the expected behavior - the upgrade must proceed even if the service fails to start. If the service doesn't start, someone will notice it very quickly and will change the credentials.
everyone, I'm using Wix to make an installer to run a service, below are my problems:
I use a custom action to call sc.exe to install and start the service, then I use custom action to call sc.exe [stop/delete] to remove the service when uninstall. This works fine except that a messagebox says
"The setup must update files or services that cannot be updated while the system is running, if you choose to continue, a reboot will be required to complete the setup"
But in fact after I click "OK", no reboot happened, and the service uninstalled successfully, how can I get rid of this message box?
Another problem is that, after click "OK" in the message box, another messagebox will pop up and tells me that "Another program has exclusive access to file [fileA], please click retry", and after I click retry, the uninstall finished successfully. [fileA] has been removed, but another file [fildB] was left behind.
but I do use a component :
<Component
<RemoveFile ..
<RemoveFile ...
</Component>
to remove these files. and I have
<Custom Action="StopService" Before="RemoveFiles">..
<Custom Action="RemoveService" After="StopService>..
In my wix .
Anyone has some suggestions?
It seems like service may not have actually shut down by the time Windows is trying to delete it or handles or process are still open to it may be for this reason its prompting for that massage box requiring a reboot to delete.
Windows can't uninstall a service if there are process/handles open to it.
In present scenerio after reboot i guess it will delete remaining files.
Try providing wait in your Custom Action for stop and remove service Provide asyncWait in return tag.
It might Solve your problem.
You are using SC.exe to control service via. custom action instead of this i recommend you to use WIX ServiceControl element.
Try to move the StopService and RemoveService custom actions before the costing standard actions, this is where Windows Installer analyzes to see what resources are in use and decides it if will prompt the user with the mentioned message box or not.
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