VbsEdit, the award-winning VBScript editor that dramatically reduces the time you spend writing .VBS scripts

Sample scripts


Operating System
   Services
       Monitor Changes in Service Status , WMI

' Monitor Changes in Service Status


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colServices = objWMIService. _ 
    ExecNotificationQuery("Select * from __instancemodificationevent " _ 
        & "within 30 where TargetInstance isa 'Win32_Service'")
i = 0

Do While i = 0
    Set objService = colServices.NextEvent
    If objService.TargetInstance.State <;>; _ 
        objService.PreviousInstance.State Then
        Wscript.Echo objService.TargetInstance.Name _ 
            &  " is " & objService.TargetInstance.State _
                & ". The service previously was " & _
                    objService.PreviousInstance.State & "."
    End If
Loop



VbsEdit includes all these samples!




Download Now

This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.
The evaluation version never expires.



Home

Copyright (C) 2001-2014 Adersoft