Uninstalling an application with QTP code

  • Questions
  • Uninstalling an application with QTP code
Question ID: 104848
0
0

I am wanting to automate an uninstall of an application or applications possibly in my QuickTest Pro script. Is there any way to uninstall an application? I don’t see any built in functions to do this?

Marked as spam
Posted by (Questions: 188, Answers: 22)
Asked on February 6, 2013 8:05 pm
18 views
Answers (1)
2
Private answer

Here's some code for you to try. It uses external Windows objects to run an uninstall of a fictional application (My Application) in VBScript:

strComputer = ''.''
Set objWMIService = GetObject(''winmgmts:'' _
& ''{impersonationLevel=impersonate}!\'' & strComputer & ''rootcimv2'')

Set colSoftware = objWMIService.ExecQuery _
(''Select * from Win32_Product Where Name = 'My Application''')

For Each objSoftware in colSoftware
objSoftware.Uninstall()
Next

Marked as spam
Posted by (Questions: 2, Answers: 438)
Answered on February 6, 2013 8:06 pm