Verify "suppressUnattendedReboot" option of Install4j - install4j

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.

Related

PowerShell: Change to module shows no effect - some kind of recompile needed?

I am currently in the process of setting up a DSC pull server using the DSC resource kit wave 8.
Unfortunatelly the module MSFT_xDSCWebService.psm1 has a bug and throws an exception when ever another locale then 'en' is in use.
The exception message tells me it's looking for a file called resource.dll in the wrong place. I have therefor made changes to the module, so it looks in the right place.
However the changes show no effect, even a Write-Host "Test... is not showing up in the output. Is there somekind of cache that needs a refresh?
Make sure that in your Local Configuration Manager (LCM) settings, you set AllowModuleOverwrite to $true.
This may be because DSC has already loaded the previous version of the module - which is in memory. An easy way to refresh is to bring down the DSC process and run the configuration again (do not try this on a production system as other WMI providers are co-hosted with DSC)
gps wmiprvse | ?{$_.modules.ModuleName -ieq 'dsccore.dll'} | kill -Force

Use Wix Installer to install a service.

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.

Issue when uninstalling a service?

I am trying to uninstall a recently installed service, I am running this in command line:
c:\Windows\Microsoft.NET\Framework\v4.0.30319>installutil.exe /u "C:\inetpub\www
root\xxx\xxx\xxx.exe"
But I am getting this:
The uninstall has completed.
An exception occurred while uninstalling. This exception will be ignored and the
uninstall will continue. However, the application might not be fully uninstalle
d after the uninstall is complete.
And this:
Removing EventLog source xxx.
An exception occurred during the uninstallation of the System.Diagnostics.EventL
ogInstaller installer.
System.Security.SecurityException: Requested registry access is not allowed.
An exception occurred while uninstalling. This exception will be ignored and the
uninstall will continue. However, the application might not be fully uninstalle
d after the uninstall is complete.
I have no idea where to begin and I really need to uninstall these so any help is appreciated
I was facing exact same issue.
The issue is resolved by opening the Command Prompt as Administrator.
My guess is that you are probably trying to remove a service using a user account which does not have sufficient rights. Specifically, the issue in this case is the removal of some EventLog registry keys during Uninstall.
This may also occur when you are logged in as a user with Administrator privileges yet did not run the Command Prompt in 'Administrator Mode'.
One way to fix this is to make sure that you are running the Command Prompt in Administrator mode. (Right-click > Run as Administrator)
I have also encountered some cases where this method still fails to solve the SecurityException problem due to some registry keys not having 'Full Control' permissions for Administrator accounts.
The following keys should have 'Full Control' set for Administrators in order for the service to be able to write to the EventLog:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application
This may be done by:
Invoking the Windows Registry Editor
Run [Win + R]
Type 'regedit'
OK
Navigate a path listed about
Right click on the desired path
Make sure that both Read and Full Control permission checkboxes are ticked for Administrators
Click Apply and OK
Repeat the same process for the other path

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

Wix: Can execute a custom action before InstallValidate?

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.