Jump to content

Recommended Posts

Posted

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
Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...