我想要做的是获取服务的帐户凭据并在ftp请求中使用它们。我没有找到任何能给我凭据的东西。这甚至可能吗?
如果没有任何东西只是给我登录凭据,我使用以下代码来获取用户名。有没有办法从用户名获取有用的凭据?
System.Management.SelectQuery sQuery = new System.Management.SelectQuery(string.Format("select * from Win32_Service where name = '[SERVICENAME]'"));
using (System.Management.ManagementObjectSearcher mgmtSearcher = new System.Management.ManagementObjectSearcher(sQuery))
{
foreach (System.Management.ManagementObject service in mgmtSearcher.Get())
{
string servicelogondetails =
string.Format("Name: {0} , Logon : {1} ", service["Name"].ToString(), service["startname"]).ToString();
Console.WriteLine(servicelogondetails);
}
}