Ask a Question

Uninstall desktop application from control panel by VB script

nikki85
Contributor

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

   ObjService.Uninstall()
  Next
End Sub

 


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

3 REPLIES 3
Marsha_R
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

tristaanogre
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
cancel
Showing results for 
Search instead for 
Did you mean: