- Set wmi = GetObject("winmgmts:\\.\root\cimv2")
- sname = "Print Spooler" '指定服务名称
- Do while true
- Set Items = wmi.ExecQuery("Select * From Win32_Service where DisplayName='"&sname&"'")
- For Each Item In Items
- If Item.State = "Stopped" Then Item.StartService()
- Next
- WSH.Sleep 1000*300
- Loop
复制代码
|