WMI,如何禁用计算机某项服务

None.gif strComputer  =   " . "
None.gif
Set  objWMIService  =   GetObject ( " winmgmts:\\ "   &  strComputer  &   " \root\cimv2 " )
None.gif
None.gif
Set  colServiceList  =  objWMIService.ExecQuery _
None.gif    (
" Select * from Win32_Service where Name = 'Alerter' " )
None.gif
None.gif
For   Each  objService in colServiceList
None.gif    
If  objService.State  =   " Running "   Then
None.gif        objService.StopService()
None.gif        Wscript.Sleep 
5000
None.gif    
End   If
None.gif    errReturnCode 
=  objService.ChangeStartMode( " Disabled " )   
None.gif
Next
None.gif
Set  colServiceList  =   Nothing
None.gif
Set  objWMIService  =   Nothing

转载于:https://www.cnblogs.com/LCX/archive/2006/08/24/485245.html

你可能感兴趣的:(WMI,如何禁用计算机某项服务)