What am I missing? I keep getting an error on line:
Set refSink = CreateObject("WBemScripting.SWbemSink","EVENTSINK_")
***********************************
<html>
<head>
<title>Service Monitor</title>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<HTA:APPLICATION
ID = "XApp"
APPLICATIONNAME = "Service Monitor"
BORDER = "thick"
CAPTION = "yes"
ICON = ""
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
SYSMENU = "yes"
WINDOWSTATE = "normal"
SCROLL = "no"
SCROLLFLAT = "yes"
VERSION = "1.0"
INNERBORDER = "no"
SELECTION = "no"
MAXIMIZEBUTTON = "yes"
MINIMIZEBUTTON = "yes"
NAVIGABLE = "yes"
CONTEXTMENU = "yes"
BORDERSTYLE = "normal">
<OBJECT ID="WindowsShell"
CLASSID="clsid:13709620-C279-11CE-A49E-444553540000"></Object>
<OBJECT ID="refSink"
CLASSID="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></OBJECT>
<SCRIPT LANGUAGE="VBScript">
Set WshShell = CreateObject("WScript.Shell")
Set WSHFso = CreateObject("Scripting.FileSystemObject")
Window.ResizeTo 600, 650
Window.MoveTo 5, 5
Dim refWMI
Dim refSink
Dim strQuery
Dim strComputer
Dim strServiceName
Dim iCheckEvery
Sub Test()
strComputer = "." 'Server to check
iCheckEvery = 30 'Seconds between checks
'connect to WMI and create a sink object
Set refWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set refSink = CreateObject("WBemScripting.SWbemSink","EVENTSINK_")
'execute an async notification query and block with a msgbox
strQuery = "SELECT * FROM __instancemodificationevent " & _
"WITHIN " & iCheckEvery & " WHERE TargetInstance ISA 'Win32_Service'"
refWMI.ExecNotificationQueryAsync refSink, strQuery
MsgBox("Now blocked and waiting...")
'cancel event notification
refSink.Cancel
Set refSink = Nothing
Set refWMI = Nothing
End Sub
'callback for Event Notification
Sub EVENTSINK_OnObjectReady(refEvent,refContext)
Msgbox(refEvent.TargetInstance.State)
End Sub
</script>
</head>
<body>
<form name="form1">
<input name="bTest"type="button" value="Open" onClick="Test">
</form>
</body>