Reputation: 1205
I am new to wix but I have to use it for a project. I need to disable the ability of the user to change his password. To do this I want to add/change a registry entry but this does not work:
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="*">
<RegistryKey Root="HKCU"
Key="Software\Microsoft\Windows\CurrentVersion\Policies\System">
<RegistryValue Type="integer" Name="DisablePW" Value="1" KeyPath="yes"/>
<RegistryValue Type="string" Value="Default Value"/>
</RegistryKey>
</Component>
</DirectoryRef>
Under Policies there is no System key yet so I assumed this would create one.
Upvotes: 3
Views: 6853
Reputation: 42126
You should never write to such a crucial and policy controlled Windows registry key.
My guess is the domain controller will revert these settings via group policy:
...by default, Microsoft Windows refreshes its policy settings every 90 minutes with a random 30 minutes offset
Things certainly could also be reset during a logon script, or some other management feature as well.
This is not a solution - your application needs redesign. Why on earth do you need to disable users ability to change password anyway? It is really bad practice to mess around with settings such as these. Anything under Software\Microsoft\Windows\CurrentVersion\Policies\
should not be messed with at all.
Upvotes: 1
Reputation: 1205
Never forget to add the component id in between the Feature tags. If not it will not be included in the installer.
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="RegistryEntries"/>
</Feature>
PS.: IMHO and other answers here in SO Wix should only handle adding completely new registry values (which do not exist before installation) because upon uninstall they will be deleted. If you want to modify or remove registry entries make sure to use custom action (script, program, batch, .reg,...) to roll this changes back.
Upvotes: 1