**********************************************************************
'**   
'**  Remove MOM 2005 Agent
'**  Author: Jesse.Harris
'**  Date: 2/7/05
'**           
'**     Info:    Run via cmd line and add a server name, the script will
'**            remove MOM 2005 agent from supplied server.
'**           
'**

'**  Revision History:                         
'**                                 
'**  Date        Author            Comment           
'**********************************************************************

 
Set WshAppObj = WScript.Application
Set ArgObj = WshAppObj.Arguments
Set oArgs = wscript.arguments


strComputer = oArgs(0)

wmiSvc = "winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"

wscript.echo wmisvc
 
Set objWMIService = GetObject(wmiSvc)
 
Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product Where Name = 'Microsoft Operations Manager 2005 Agent'")
 
For Each objSoftware in colSoftware
    wscript.echo "Removing: " & objSoftware.Name
    objSoftware.Uninstall
Next