; // 暂停指定的服务
public string PauseService(string serviceName)
{
string strRst = null;
ManagementObject mo = this.managementClass.CreateInstance();
mo.Path = new ManagementPath(this.strPath+".Name=\""+serviceName+"\"");
try
{
//判断是否可以暂停
if((bool)mo["acceptPause"]&&(string)mo["State"]=="Running")
mo.InvokeMethod("PauseService",null);
}
catch(ManagementException e)
{
strRst =e.Message;
}
return strRst;
}
// 恢复指定的服务
public string ResumeService(string serviceName)
{
string strRst = null;
ManagementObject mo = this.managementClass.CreateInstance();
mo.Path = new ManagementPath(this.strPath+".Name=\""+serviceName+"\"");
try
{
//判断是否可以恢复
&nb