Forum Discussion
- AlexKarasChampion Level 3Hi Audrey,
Maybe this thread will help...
http://smartbear.com/forums/forum/post/?mode=singleThread&thread=c8180fd1-d3bf-4b4b-9495-0a9e28bb1fd8
Hi Audrey,
Does TestComplete record any actions with installer objects?
If it does not, try disabling UAC or running TestComplete with administrator privileges. For more information, refer to the Testing Applications With TestComplete Under Windows Vista and Later Operating Systems help topic.- pjaudreyOccasional ContributorHi,
1. The return objectlist is empty. Could you please advice way forward. Thanks..
2. Attached jpg for my application nameSub UninstallApplication()
Dim wmiService, objectsList, ObjService
Dim computerName, applicationName
computerName = "mykul009647w"
applicationName = "MYOB EXO Business"Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product " & "WHERE Name='" & applicationName & "'")
Call log.Error(objectsList.count)
'HEREOK
For Each ObjService in ObjectsList
'Script did not enter into this loop
If (Not ObjService.item.Uninstall()) Then
Call Log.Error("An error occurs when uninstalling the " & applicationName & " application")
UninstallApplication = False
Exit Sub
End If
Exit Sub
Next
'UninstallApplication = True
Call Log.Error("Exit")
End sub
Regards,
audrey Ng - AlexKarasChampion Level 3Hi Audrey,
What is the architecture/bitness of the application been uninstalled (32 or 64 bit) and what OS you are working on (name, version and bitness)?
Also, what setup authoring software was used to create the installer?
Hi Audrey,
Have you succeeded in automating the installation process?
Also, in addition to answering Alexei's questions, please follow the steps below:
1. Check whether your software is on the list of products installed with Windows Installer. To do this, execute the following command prompt:
wmic product get name
If the application is on the list, proceed to the next step.
2. Execute the following code:
computerName = "mykul009647w"
applicationName = "MYOB EXO Business"
Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product " & "WHERE Name='" & applicationName & "'")
Log.Message(objectsList.Count)
What result do you get in the log?
3. Execute the following code:
computerName = "mykul009647w"
applicationName = "MYOB EXO Business"
Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product WHERE Name='" & applicationName & "'",,0)
Log.Message(Err.Number)
What result do you get in the log?- pjaudreyOccasional ContributorHi,
1. My application is able to support both 32 and 64 bits.
2. OS - Windows 7 / 32 bits
3. Setup authoring software used to create the installer - wise installer4. Result for below -
0
Exit
computerName = "mykul009647w"
applicationName = "MYOB EXO Business"
Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product " & "WHERE Name='" & applicationName & "'")Log.Message(objectsList.Count)
What result do you get in the log?
5. Execute the following code:
Result - 0computerName = "mykul009647w"
applicationName = "MYOB EXO Business"Set wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & computerName & "\root\cimv2")
Set objectsList = wmiService.ExecQuery("SELECT * FROM Win32_Product WHERE Name='" & applicationName & "'",,0)
Log.Message(Err.Number)
Regards,
Audrey NG - AlexKarasChampion Level 3Hi Audrey,
> 3. Setup authoring software used to create the installer - wise installer
It is quite possible that Wise misses some registry entries required by WMI/Windows Installer. Especially if the installation was not explicitly targeted possibility to be installed on 64-bit system (I saw similar problems for WiX installations).
Have you tried 'visual' approach that was discussed and provided with code samples in the thread(s) I referenced in one of my previous replies?
Also:
What if you replace
For Each ObjService in ObjectsList
with something like
For i = 0 To ObjectsList.Count - 1
Set ObjService = ObjectsList.ItemIndex(i)
...
Next
Hi Audrey,
Uninstalling programs that use Wise Installer is impossible with WMI. Try using an alternative approach mentioned in the thread Alexei quoted to uninstall an application.- pjaudreyOccasional ContributorHi Alex,
Are you refering to the below links:-
http://smartbear.com/forums/forum/post/?mode=singleThread&thread=c8180fd1-d3bf-4b4b-9495-0a9e28bb1fd8
The codes posted by Du Tran (30 May 2011, 01:41 PM) ?
Regards,
Audrey - pjaudreyOccasional ContributorHi David,
Thank you so much for your reply and Yes, and received the below results:-
If Not p.Exists Then
Call Log.Error("The 'Add or remove programs' dialog was not found")
Audrey
Related Content
- 3 years ago
- 5 months ago
Recent Discussions
- 4 days ago
- 4 days ago