Ask a Question

Uninstall of application saying 'access denied'

endorium
Frequent Contributor

Uninstall of application saying 'access denied'

I have the below script that I am running on windows 10. When I run it it says access denied in the failure log. Test complete is being run as administrator. any ideas?

 

function NGSUninstall(/*computerName, applicationName*/)

{
var computerName = "PC412079"
var applicationName = "Avenio Connect"
if (!UninstallApplication("computerName", "applicationName"))

Log.Error("Error");

}

 

function UninstallApplication(/*computerName, applicationName*/)

{
var computerName = "PC412079"
var applicationName = "Avenio Connect"
var wmiService, computerName, objectsList, eObjectsList;

 

try{

wmiService = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\\\" +

computerName + "\\root\\cimv2");

}

catch(exception) {

Log.Message(exception.description);

return;

}

 

objectsList = wmiService.ExecQuery('SELECT * FROM Win32_Product ' +

'WHERE (Name="' + applicationName + '")');

 

if (objectsList.Count <= 0) {

Log.Error('"' + applicationName + '" was not found');

return false;

}

 

eObjectsList = new Enumerator(objectsList);

for (; !eObjectsList.atEnd(); eObjectsList.moveNext()) {

if (eObjectsList.item().Uninstall() != 0) {

Log.Error('An error occurs when uninstalling the "' +

applicationName + '" application');

return false;

}

}

return true;

}

 

 

4 REPLIES 4
Marsha_R
Community Hero

Re: Uninstall of application saying 'access denied'

Are you able to go through this process manually (without using TestComplete) and not see any errors?

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
endorium
Frequent Contributor

Re: Uninstall of application saying 'access denied'

yes,i can uninstall manually

endorium
Frequent Contributor

Re: Uninstall of application saying 'access denied'

exact same function works on windows 7 machine

tristaanogre
Community Hero

Re: Uninstall of application saying 'access denied'

The problem is probably related to the increased user security in Windows 10.  While you may be running TC as an administrator, there is still interaction necessary in Windows 10 to get that to work unless you change the User Account Control Settings to not require interaction when software installation occurs.  Try changing those settings to a lower level and see if that corrects the problem .


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: