Sign in to follow this  
Followers 0
gcue

Uninstalling Software Remotely

6 posts in this topic

hello.

i am using Water's script to list out applications.

http://www.autoitscript.com/forum/index.php?showtopic=114962&view=findpost&p=803556

it doesnt seem that my app comes up on that list (even though its in add/remove)

so im having problems removing it.

any ideas why its not coming up?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

you're right.. i cleaned it up.. here's what im trying now (i have admin rights on the local machines in question)...

again, the list is only partial - doesnt show the app i want to uninstall.

as you can see, if i chose %photoshop% i see 2 results. the app im trying to remove is Superblock (as shown in Add/Remove) but it doesnt show as part of the list so I cant remove it

$oMyError = ObjEvent("AutoIt.Error", "_AD_ErrorHandler") ; Install a custom error handler

$Machine = InputBox("Computer name?", "Uninstall Remote Application")
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $Machine & "\root\cimv2")

;$Products = $objWMIService.ExecQuery("SELECT * FROM Win32_Product")
$Products = $objWMIService.ExecQuery("SELECT * FROM Win32_Product Where Name like '%Super%'")
;$Products = $objWMIService.ExecQuery("SELECT * FROM Win32_Product Where Name like '%Photoshop%'")
For $element In $Products
    ConsoleWrite($element.name & @CRLF)
Next


Func _AD_ErrorHandler()

    Local $bHexNumber = Hex($oMyError.number, 8)
    ConsoleWrite("COM Error Encountered in " & @ScriptName & @CRLF & _
            "Scriptline = " & $oMyError.scriptline & @CRLF & _
            "NumberHex = " & $bHexNumber & @CRLF & _
            "Number = " & $oMyError.number & @CRLF & _
            "WinDescription = " & StringStripWS($oMyError.WinDescription, 2) & @CRLF & _
            "Description = " & StringStripWS($oMyError.description, 2) & @CRLF & _
            "Source = " & $oMyError.Source & @CRLF & _
            "HelpFile = " & $oMyError.HelpFile & @CRLF & _
            "HelpContext = " & $oMyError.HelpContext & @CRLF & _
            "LastDllError = " & $oMyError.LastDllError & @CRLF & _
            "========================================================" & @CRLF)

EndFunc ;==>_AD_ErrorHandler
Edited by gcue

Share this post


Link to post
Share on other sites

ahh looks like the Win32_Product Class only displays products installed using Windows Installer... so how can i pipe in to the reg key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" and still use WMI to remove the application??

thanks

Share this post


Link to post
Share on other sites

I am unfamiliar with the SuperBlock application, are you able to give a MSIEXEC.exe command to call the uninstallation? i.e.

Run ('msiexec.exe "[Application uninstall path]" /uninstall /qn '

In the /qn switch will make it invisible to the user and you can use a Run() command in AutoIt to complete this. If not, what type of command does it give you in the HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\ location for the either the UninstallString or ModifyPath values? Those should be your tip offs for running the uninstall. If it run's from an InstallSheild uninstaller you may need the SID of the application listed in the registry to run it.

Also, are you planning on running the script from a remote location to the users or locally on their systems, but deployed via the network. Credentials was my only concern. Let us know and good luck.

Montel

Share this post


Link to post
Share on other sites

thanks Montel.

i have local admin rights on all domain pcs. i will be running this remotely.

i also found this informative article

http://community.flexerasoftware.com/archive/index.php?t-139626.html

looks like id have to identify what type of install then proceed from there.

thanks for the info! i definitely have something to go play with....

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