简体   繁体   English

使用wix安装程序创建注册表项

[英]Creating registry key with wix installer

I am new to wix but I have to use it for a project. 我是wix的新手,但我必须将它用于一个项目。 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. 在策略下,还没有系统密钥,所以我认为这会创建一个。

You should never write to such a crucial and policy controlled Windows registry key. 您永远不应该写入这样一个关键且受策略控制的Windows注册表项。

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 ...默认情况下,Microsoft Windows每90分钟刷新一次策略设置,随机30分钟偏移

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. Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\下的任何内容都不应该被搞乱。

Never forget to add the component id in between the Feature tags. 永远不要忘记在Feature标记之间添加组件ID。 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. PS:恕我直言和SO Wix中的其他答案应该只处理添加全新的注册表值(安装前不存在),因为在卸载时它们将被删除。 If you want to modify or remove registry entries make sure to use custom action (script, program, batch, .reg,...) to roll this changes back. 如果要修改或删除注册表项,请确保使用自定义操作(脚本,程序,批处理,.reg,...)来回滚此更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM