Ask a Question

Uninstall desktop application from control panel by VB script


Uninstall desktop application from control panel by VB script

Sub UninstallApplication(computerName, applicationName)

  Dim wmiService, objectsList, ObjService
  Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\"& computerName & "\root\cimv2")
  Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product " & "WHERE Name='" & applicationName & "'")

  For Each ObjService in ObjectsList

End Sub


it works fine for me in windows 7 ; but not for windows 10, i want something similar to work in windows 10.

Champion Level 2

You really haven't given us any information to work with here.  What happens when you try it in Windows 10?

ObjService.Uninstall() returns 1603

Esteemed Contributor

Keep in mind Windows 10 UAC is much different than Windows 7.  It could be that Windows 10 UAC is set to a level that does not allow that uninstall.  Try adjusting the UAC settings on your Windows 10 box to the lowest setting and try again.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Showing results for 
Search instead for 
Did you mean: