Jump to content
Sign in to follow this  
jitendra

Script for uninstalling a software

Recommended Posts

jitendra

I need a script to open Add/Remove programs and then select the application and clicking uninstall.

Please help me

Share this post


Link to post
Share on other sites
somdcomputerguy

Here's a link to a script with just about everything you need AutoIt.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
PsaltyDS

I need a script to open Add/Remove programs and then select the application and clicking uninstall.

Please help me

If it's listed in Add/Remove Programs, then it has an entry in the registry. For example, Flash 10 is at:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0DFB3DE8-65B9-44FF-AA0A-3BECC5A2BFD1}

Under that location is the executable string for uninstall in the "UninstallString".

Find\Get that string and execute it with Run() or RunWait()

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Juvigy

Check this out :

Func WMIService($host) ;Connects to WMI Service
    $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $host & "\root\cimv2")
    If not IsObj($objWMIService) Then return 0
    return $objWMIService
EndFunc

Func WMIQuery($objWMIService,$strWMIQuery) ;Perform WMI Query with Query String and Data Return Parameters
    $colItems = $objWMIService.ExecQuery($strWMIQuery) 
        For $objItem in $colItems
            ;MsgBox(0,"asdasd",$objitem.name)
            $objItem.Uninstall()
        Next
    return 1
EndFunc

$objWMIService = WMIService("localhost")  ;WMIService Object - Establish Connection
If $objWMIService = 0 Then Exit

;~ $objWMIService1 = WMIService("localhost")  ;WMIService Object - Establish Connection
;~ If $objWMIService1 = 0 Then Exit

$soft1 = WMIQuery($objWMIService,"Select * from Win32_Product Where Name like '%Photoshop%'")
If $objWMIService = 0 Then 
    MsgBox(0,"Error","An error have accured")
    Exit
    EndIf
    $objWMIService =  0

MsgBox(0,"Success","Uninstall compleeted successfully")

This line:

$soft1 = WMIQuery($objWMIService,"Select * from Win32_Product Where Name like '%Photoshop%'")

is where you specify what to uninstall. The example uninstall everything that has "Photoshop" in the title.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.