开发者

How to prevent a Windows user from being removed and created during a patch

I have a project that uses the WiX extension WixUtilExtension to create a user for our Windows services. When I patch the installation (using an .msp), the custom actions RemoveUser and CreateUser are executed.

I开发者_运维知识库 don't want these WiX extension created custom actions to run during a patch.

I can add a condition directly to the custom action (ConfigureUsers) in the InstallExecuteSequence table of the MSI to prevent this, but I have not found a way to handle this in WiX.

Using WiX, how can I prevent RemoveUser and CreateUser from being executed during a patch?

<util:Group Id="LocalAdministrators" Name="Administrators"/>
<DirectoryRef Id="INSTALLLOCATION" DiskId="1">
    <Component Id="CreateServiceAccountUser" Guid="{614550A7-C766-4B5D-9BF9-233D07EB3B69}">

        <util:User Id="ServiceAccountUser"
                   CanNotChangePassword="yes"
                   CreateUser="yes"
                   Disabled="no"
                   FailIfExists="no"
                   LogonAsService="yes"
                   Name="TestUser"
                   Password="testuserpw"
                   PasswordExpired="no"
                   PasswordNeverExpires="yes"
                   RemoveOnUninstall="yes"
                   UpdateIfExists="yes">
            <util:GroupRef Id="LocalAdministrators"/>
        </util:User>

        <RegistryKey Root="HKMU" Key="Software\AMT\WebBrix">
            <RegistryValue Name="CreateServiceAccountUser"
                           Value="Common"
                           Type="string"
                           KeyPath="yes" />
        </RegistryKey>

    </Component>
</DirectoryRef>


You can do that in WiX:

<InstallExecuteSequence>
    <Custom Action='ConfigureUsers' 
            After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>

Here are some more conditions

  1. Action run only during Install Condition: NOT Installed AND NOT PATCH
  2. Action only runs during removal of MSI Condition: REMOVE
  3. Action runs during Install and repair Condition: NOT REMOVE
  4. Action runs during Install and remove Condition: There must be no condition
  5. Action calls EXE installed by MSI Condition:NOT Installed AND NOT PATCH
  6. Run on initial installation only: NOT Installed
  7. Run on initial install or when repair is selected. NOT Installed OR MaintenanceMode="Modify"
  8. Run when being uninstalled from command line or add / remove menu. REMOVE~="All" OR MaintenanceMode="Remove"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜