[wix-users] [WiX 3.10] How can I preserve a user created during installation between major upgrades?

Stan Domeshok sdomeshok at unitrends.com
Thu Nov 26 19:44:28 PST 2015


This post is substantially lifted from my SO thread at https://stackoverflow.com/questions/33929018/how-can-i-preserve-a-user-created-during-installation-between-major-upgrades.<https://stackoverflow.com/questions/33929018/how-can-i-preserve-a-user-created-during-installation-between-major-upgrades>


I am using the WiX util User element to create a user during installation. We are using a block similar to the following

<util:User Id="serviceUser"
               Name="[USER_NAME]"
               CanNotChangePassword="yes"
               CreateUser="yes"
               FailIfExists="yes"
               LogonAsService="yes"
               RemoveOnUninstall="yes"
               Password="[USER_PASS]">
</util:User>

I want to make sure that the user will always be created and I want it to be rolled back during uninstall but not during upgrade because that would mess up some credentials that we use.

I opened the generated MSI in Orca to see the generated action sequence and was confused. The only custom action relating to users that has as schedule is ConfigureUser at sequence number 3999. CreateUser and DeleteUser are not scheduled at all.


I have tried to manually override the scheduling of these actions

    <InstallExecuteSequence>

      <Custom Action="RollbackCreateUser" Sequence="4200"> not (installed and UPGRADINGPRODUCTCODE) </Custom>

      <Custom Action="CreateUser" Sequence="4201"> not (installed and UPGRADINGPRODUCTCODE) </Custom>

    </InstallExecuteSequence>


And while they appear in the InstallExecuteSequence table in the final MSI, the custom action conditions don't seem to actually be respected by msiexec.


Does anyone have any experience with this kind of use case, is there a substantially better approach that I should be taking?


More information about the wix-users mailing list