• λ我爱Aspx >> Asp.Net >> 使用C#控制远程计算机的服务
  • 使用C#控制远程计算机的服务

  • :未知  Դ:internet  :2007-5-20 16:43:53  ؼ:c#
  • int i = 0;

    foreach(ManagementObject mo in this.managementClass.GetInstances())

    {

    services[i,0] = (string)mo["Name"];

    services[i,1] = (string)mo["DisplayName"];

    services[i,2] = (string)mo["State"];

    services[i,3] = (string)mo["StartMode"];

    i++;

    }

    return services;

    }

    // 获取所连接的计算机的指定服务数据

    public string [,] GetServiceList(string serverName)

    {

    return GetServiceList(new string []{serverName});

    }

    // 获取所连接的计算机的的指定服务数据

    public string [,] GetServiceList(string [] serverNames)

    {

    string [,] services = new string [serverNames.Length,4];

    ManagementObject mo = this.managementClass.CreateInstance();

    for(int i = 0;i<serverNames.Length;i++)

    {

    mo.Path = new ManagementPath(this.strPath+".Name=\""+serverNames[i]+"\"");

    services[i,0] = (string)mo["Name"];

    Ҷƪл˵?
  • һƪ使用C#调用外部Ping命令获取网络连接情况
    һƪ使用C#编写的一个定时关机程序