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
Community Hero

Re: Uninstall desktop application from control panel by VB script

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

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
nikki85
Contributor

Re: Uninstall desktop application from control panel by VB script

ObjService.Uninstall() returns 1603

tristaanogre
Community Hero

Re: Uninstall desktop application from control panel by VB script

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: