如何在安装时自动允许我的服务与桌面交互?
我构建了一个 Windows 服务,正在通过 .NET 2.0 的 installutil /i
命令安装该服务。 它使用以下帐户和密码安装服务:
NT AUTHORITY\LocalService
当我使用 net start
运行我的服务时,我得到
Error 5: Access Denied
要删除它,我必须打开 services .msc
并从属性中提供服务
Logon As -> Local System Account
-> Allow Service to interact with desktop.
我可以将整个“点击”业务放入本机 .NET C# 代码或 WMI 或其他批处理脚本中吗? 无论如何我都会使用批处理脚本,所以两者都可以。
I have a Windows service built which is being installed by .NET 2.0's installutil /i
command. It installs the service as with the following account, with a password:
NT AUTHORITY\LocalService
When I run my service with net start <serviceName>
, I get
Error 5: Access Denied
To remove it I've had to open up services.msc
and from the Properties give the service
Logon As -> Local System Account
-> Allow Service to interact with desktop.
Can I put this whole “clicky” business into code which is either native .NET C# code or WMI or some other Batch script? I'll be using a batch script anyways so either is fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了答案,非常感谢我给予充分信任的以下网页。
链接文本
这是我的解决方案,只需根据需要更改您的服务名称即可。 将其放入 C# 控制台应用程序中并运行它:)
}
Figured out an Answer, thanks very much to the following Webpage to which I give full credit.
link text
Here's the Solution I have, just change your service name as needed. Throw it in a C# Console App and run it :)
}