我需要使用InstallUtil来安装C# Windows服务。我需要设置服务登录凭据(用户名和密码)。这一切都需要默默地完成。
有没有办法做这样的事情:
installutil.exe myservice.exe /customarg1=username /customarg2=password
最佳答案
比上面的帖子更简单的方法并且在安装程序中不需要额外的代码是使用以下内容:
installUtil.exe /username=domain\username /password=password /unattended C:\My.exe
只需确保您使用的帐户有效即可。如果没有,您将收到“帐户名称和安全 ID 之间未完成映射”异常
关于.net - 使用InstallUtil并静默设置Windows服务登录用户名/密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/140054/