Sign in to follow this  
Followers 0
loup001

Application Removal via AutoIT

6 posts in this topic

I am working on an AutoIT script to remove a application from Win7.

The application can be removed via Win7 Add/Remove programs, but I need to script the remova, so is there any way to remove the application using AutoIT?

Thanks!

Share this post


Link to post
Share on other sites



Sure can, it's an AutoIt thing to do such.

It may be as simple as reading a value in the registry, then using that to run its uninstaller.

Whip up some code, and we will help you through any hurdles you come across.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

@loup001,

if the application you want to remove was written inside some standards and best practices, it will have an uninstall key in the registry... (it's easy)

If not, the application is installed, it works, but how to uninstall is a way so that those who created the program knows.
If the second option, it is difficult to uninstall a program in an automated way.
I'm not on the computer that has the examples of which I speak, will post later.
 
Br, Detefon

Visit my repository

Share this post


Link to post
Share on other sites

If it is in Add/Remove Programs then it has an entry in the registry. Look in the following places:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall (32 bit machines)

HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall (64 bit machines)

For 64bit machines, always look in both locations.

Once you find the key for the software you seek, you should see a value for UninstallString. That is what you want to script. For example:

;UninstallString value for Microsoft Visual C++ 2010
;MsiExec.exe /X{196BB40D-1578-3D01-B289-BEFC77A11A1E}

ShellExecuteWait("Msiexec.exe", "/x {196BB40D-1578-3D01-B289-BEFC77A11A1E} /qb") ;Add the /qb switch so you can see progress

Alternatively, you can use WMI:

;Prompt for the name of an application, and then uninstall through WMI

#include <MsgBoxConstants.au3>

$sName = InputBox("Uninstall Wizard", "Please type the first few letters of the application name to search")
$oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2")
$aProducts = $oWMI.ExecQuery("Select * from Win32_Product Where Name LIKE '%" & $sName & "%'")

For $app in $aProducts
    $popup = MsgBox($MB_YESNOCANCEL, "Uninstall Wizard", "Would you like to uninstall " & $app.Name & "?")
        If $popup = $IDYES Then
            $app.Uninstall()
        ElseIf $popup = $IDCANCEL Then
            ExitLoop
        EndIf
Next

This could easily be modified if you would just like to input the name of the application, rather than being prompted for it. It can also be easily modified to allow uninstallation of applications on remote PCs.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Look my signature  title="">GetInstalledApps 

I cant remember well. but I think the method index 6 is Uninstall.

Saludos

Share this post


Link to post
Share on other sites

Thanks everyone - with your suggestions, I was able to use the reg entry and build the removal script.

Greta suggestions!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0