Forum Discussion
1. The return objectlist is empty. Could you please advice way forward. Thanks..
2. Attached jpg for my application name
Sub 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
Related Content
- 3 years ago
- 5 months ago
Recent Discussions
- 4 days ago
- 4 days ago