我试图在我的网络系统中找到正在运行的服务。我可以得到一些,但是对于某些系统,我得到了错误:
“无法在计算机机器名称上打开服务控制管理器。此操作可能需要其他权限”
ServiceController sc = new ServiceController("OPCGlobasysService",servername);
ServiceControllerStatus st = sc.Status;
if (st.ToString().ToLower() == "stopped")
{
labelControl4.Text = "Installed but stopped";
}
if (st.ToString().ToLower() == "running")
{
labelControl4.Text = "Installed and started";
}提前感谢
发布于 2011-07-05 09:37:40
在调用之前,您应该模拟具有相关访问权限的用户。
https://stackoverflow.com/questions/6578944
复制相似问题