|
dtBase = Now()
dtTarget = dtBase
dtTarget = DateAdd( "s", 5, dtTarget )
TargetH = Hour( dtTarget )
TargetM = Minute( dtTarget )
TargetS = Second( dtTarget )
Set obj = GetObject("winmgmts:\\.\root\cimv2")
Set objEvents = obj.ExecNotificationQuery( _
"select * from __InstanceModificationEvent " & _
"where TargetInstance isa 'Win32_LocalTime' " & _
"and TargetInstance.Hour = " & TargetH & " " & _
"and TargetInstance.Minute = " & TargetM & " " & _
"and TargetInstance.Second = " & TargetS & " " _
)
Set objLatestEvent = objEvents.NextEvent
WScript.Echo _
Now() & " ( Start = " & dtBase & ")"
| |