'------------------------------------------------ 'Author: Wei_Zhu 'Creation Date: 2010.02.24 'Program Name: Check_Service_State.vbs 'Descript: Check Your Server Point Service State ' If Stopped, Start it. '------------------------------------------------ strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2") Set colRunningServices = objWMIService.ExecQuery _ ("Select * from Win32_Service") For Each objService in colRunningServices if objService.DisplayName ="WMI Performance Adapter" then 'Your Service Name if objservice.State = "Stopped" then ' Wscript.Echo objService.DisplayName objService.StartService() end if end if Next
posted on 2010-02-24 08:56 封起De日子 阅读(136) 评论(0) 编辑 收藏 举报