Help with code in Visual Studio 2008

10 pts.
Tags:
Visual Basic
Visual Studio
Visual Studio 2008
Windows Management Instrumentation
Windows Service Pack Blocker
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

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following