wix 可以提示输入 Windows 服务用户名/密码吗?
我正在使用 Wix 安装 Windows 服务。该服务需要在用户设置的非系统/服务帐户下运行。
是否可以提示输入服务登录的用户名/密码?
I am using Wix to install a windows service. The service will need to run under a non system/service account that is set up by the user.
Is it possible to have it prompt for the username/password for the service login?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
GitHub 上的社区 MSI 扩展包含一个用于提示用户名和密码的 ServiceCredDlg 对话框。根据文档,它可以测试凭据是否有效以及该用户拥有“作为服务登录”的权限。
The Community MSI Extensions on GitHub contains a ServiceCredDlg dialog for prompting username and password. According to the docs, it can test the credentials are valid and that user has 'logon as a service' rights.
是的,但它不是内置的。您可以在 WiX 中设置一个 GUI(这不是太直观),您可以在其中提示您在后续步骤中需要的任何设置。
首先,按照 创建一个设置自定义属性的 GUI这些指南,确保您的 GUI 填充属性 SERVICEACCOUNT 和 SERVICEPASSWORD。然后将 ServiceInstall 元素与这些属性结合使用,如此处所示。
Yes, but it's not built-in. You can setup a GUI in WiX (which is not too intuitive) where you can prompt for any setting you'll need in later steps.
First, check out how to create a GUI that sets custom properties by following these guidelines, ensuring that your GUI fills properties SERVICEACCOUNT and SERVICEPASSWORD. Then use the ServiceInstall element with those properties as shown here.
WiX 没有(或者至少没有)提供任何开箱即用的功能来满足您的需求。据我所知,最好的选择是自己动手。
https://www.geekproject.com/post/wix-service-account -对话框/
WiX doesn't (or at least didn't) have anything nice out of the box for what you are looking for. Best option that I am aware of is to roll-your-own.
https://www.geekproject.com/post/wix-service-account-dialog/
您可以在命令行上使用凭据设置 PUBLIC PROPERTIES(大写)并使用它们来安装服务。
msiexec.exe /I "setup.msi" /QN USER="username" PASS="password"
还可以使用自定义操作从用户处检索这些值在交互式安装期间,但如果执行此操作,请记住使消息的显示遵循设置的 UILevel 值。在静默安装中显示来自自定义操作的消息框被视为严重的安装错误:
也许最好的选择是在交互式安装中显示对话框,如果未在命令行上设置这些属性,则拒绝静默安装。这是一个简单的自定义操作,用于测试 USER 和 PASS 属性的值。
并且显然不建议使用用户帐户来运行服务。
You can set PUBLIC PROPERTIES (uppercase) with the credentials on the command line and use these to install the service.
msiexec.exe /I "setup.msi" /QN USER="username" PASS="password"
A custom action can also be used to retrieve these values from the user during an interactive install, but if you do this remember to make the display of the message obey the setups UILevel value. Showing a message box from a custom action in a silent install is considered a serious setup error:
Perhaps the best option is to show the dialog in an interactive install, and refuse to install silently if these properties aren't set on the command line. This is a simple custom action to test the values of the USER and PASS properties.
And obviously it is not recommended to use user accounts to run services.