"无法在计算机机名打开服务控制管理器。此操作可能需要其他特权" [英] "Cannot open Service Control Manager on computer machine name. This operation might require other privileges"
本文介绍了"无法在计算机机名打开服务控制管理器。此操作可能需要其他特权"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想找到正在运行的服务在我的网络系统。我能得到一些,但对于一些系统,我得到的错误:
无法在计算机机名打开服务控制管理器。此操作可能需要其他特权
的ServiceController SC =新的ServiceController(OPCGlobasysService,服务器名);
ServiceControllerStatus ST = sc.Status;
如果(st.ToString()。TOLOWER()==停止)
{
labelControl4.Text =安装,但已停止;
}
如果(st.ToString()。TOLOWER()==运行)
{
labelControl4.Text =安装并启动;
}
在此先感谢
解决方案
您应该模拟一个具有呼叫前相关接入用户。
I am trying to find running services in my network systems. I am able to get some but for some systems I am getting the error:
"Cannot open Service Control Manager on computer machine name. This operation might require other privileges"
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";
}
Thanks in advance
解决方案
You should impersonate a user that has the relevant access before making the call.
这篇关于"无法在计算机机名打开服务控制管理器。此操作可能需要其他特权"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文