Link to home
Start Free TrialLog in
Avatar of ln733
ln733

asked on

I need a VB script that will uninstall configuration manager agent......will be deploying through logon

I need a VB script that will uninstall Microsoft configuration manager 2007 agent......will be deploying through logon using GPO.   Please help!!!
Avatar of AmazingTech
AmazingTech

You need to find out the GUID for the application and run a MSIEXEC /X {GUID} /qb to uninstall.

Look in the registry

HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall

When you find it locate the UninstallString

Add the /qb to make it a silent uninstall.
Avatar of ln733

ASKER

Any other suggestions?
Did you locate the Uninstall String?

Create a .bat and apply with the GPO. Logon if your users are administrators of their workstation otherwise use Machine Startup GPO.
Avatar of ln733

ASKER

The problem with the bat file is that the command prompt is visible to the user when they logon to the machine.   It doesnt close to it has finished unistalling which could take 5 minutes.
Once you find the uninstall string you can use it in VBS.

Set objShell = CreateObject("Wscript.Shell")
 
ret = objShell.run("MSIEXEC.exe /QB /X " + chr(34) + "{GUID}" + chr(34))

Open in new window

In733, welcome to EE.

AT's suggestion to find the Uninstall string is valid.....and would help us know what command we need to run to have it uninstalled....

However, as an alternative, you could try this script, which may return a result if the Configuration Manager can be found in the Win32_Product class.

If it can (that is, if you do get some information from this script), then you would be able to invoke the Uninstall method for that product.

Regards,

Rob.
If LCase(Right(Wscript.FullName, 11)) = "wscript.exe" Then
    strPath = Wscript.ScriptFullName
    strCommand = "%comspec% /c cscript  """ & strPath & """"
    Set objShell = CreateObject("Wscript.Shell")
    objShell.Run(strCommand), 1, True
    Wscript.Quit
End If
 
On Error Resume Next
 
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product Where Name LIKE 'Microsoft Configuration%'", "WQL", _
                                       wbemFlagReturnImmediately + wbemFlagForwardOnly)
 
For Each objItem In colItems
   WScript.Echo "Caption: " & objItem.Caption
   WScript.Echo "Description: " & objItem.Description
   WScript.Echo "IdentifyingNumber: " & objItem.IdentifyingNumber
   WScript.Echo "InstallDate: " & objItem.InstallDate
   WScript.Echo "InstallLocation: " & objItem.InstallLocation
   WScript.Echo "InstallState: " & objItem.InstallState
   WScript.Echo "Name: " & objItem.Name
   WScript.Echo "PackageCache: " & objItem.PackageCache
   WScript.Echo "SKUNumber: " & objItem.SKUNumber
   WScript.Echo "Vendor: " & objItem.Vendor
   WScript.Echo "Version: " & objItem.Version
   WScript.Echo
Next

Open in new window

Oh you probably want /qn.
Avatar of ln733

ASKER

Sorry guys....this is way over my head.   To put it simple, I need to run this command "Ccmsetup.exe /uninstall" either in a bat file or vb script.  The problem with the bat is that it leaves the command line box open for the user to see when the logon.  
ASKER CERTIFIED SOLUTION
Avatar of AmazingTech
AmazingTech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ln733

ASKER

Thanks!
Thanks. Glad it worked out. A more generic uninstall for MSI apps is what I was leaning towards. So keep it in mind for other uninstalls.