10 pts.
 Help with code in Visual Studio 2008
strComputer = "."
Set objWMIServices = GetObject("winmgmts:root/default")
Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
Set ObjRegistry = GetObject("winmgmts:{impersonationLevel = impersonate}!\" _
    & strComputer & "rootdefault:StdRegProv")
objWMIServices.ExecNotificationQueryAsync wmiSink, _
    "SELECT * FROM RegistryKeyChangeEvent " _
    & "WHERE Hive='HKEY_LOCAL_MACHINE' AND " _
    & "KeyPath='Software\Microsoft\Windows\CurrentVersion\Uninstall'"
WScript.Echo "Listening for Registry Change Events..."
 
While(True)
    WScript.Sleep 1000
Wend
 
Sub SINK_OnObjectReady(EventObject, wmiAsyncContext)
    WScript.Echo "Received Registry Change Event" & vbCrLf & _
      EventObject.GetObjectText_()
End Sub
The following is a WMI code that looks for the 'Uninstall.exe' of any installed software. I am attempting to put this code into a Windows Service for my school project. But when I tested using Cscript, no result was found. I need major help.
Also, if possible, I'd like it to be converted to a VB Console Application. I know how, but one piece of coding for some reason can't converted:
Set wmiSink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
It throws a 'Remote Server cannot be found' exception.
Please help!


Software/Hardware used:
Visual Studio 2008
ASKED: July 28, 2010  2:22 AM
UPDATED: July 28, 2010  1:04 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _