我正在尝试编写像services.msc这样的服务监视工具 哪里可以使用WMI找到“登录为”属性
感谢
埃雷兹
答案 0 :(得分:0)
Setting Windows Service Account - C# and WMI有一些可能有用的c# - 它应该很容易convert到VB。
具体来说,comment by asbf看起来有你需要的东西。
string serviceName = "eventLog";
System.Management.SelectQuery query = new System.Management.SelectQuery(string.Format("select name, startname from Win32_Service where name = '{0}'", serviceName));
using (System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher(query))
{
foreach (System.Management.ManagementObject service in searcher.Get())
{
Console.WriteLine(string.Format("Name: {0} - Logon : {1} ", service["Name"], service["startname"]));
}
}