Adobe Air: A Custom Uninstaller for Distributed Apps (windows)
If you have had the fun of deploying the Adobe AIR runtime and applications to hundreds of computers in an organization you will have no doubt stumbled upon at least one or two the annoyances that pop-up. The runner up for most annoying issue in my experience is the uninstaller.
In my development of "sometimes-connected" applications I have always had to write/store data on the local machine. The lacking feature of the built in uninstaller is the complete inability to remove this data. In my environment I needed to be able to have a solid roll-back plan of a piece of software; this unsuprisingly includes any downloaded content.
To solve my delema I wrote a VBScript file to perform the uninstallation. Similar to my installation process I wrote an install wrapper with Install Jammer. I did it this way to allow for easier "distribution" via SMS. I will highlight a few steps here and provide the full script at the end of the post. This script is obviously meant for Windows only and should work on windows XP, Vista and Windows 7. I have yet to have to distribute an app to anything other than a windows box.
First I grab the installer ID from the install path.Set wmiObj = CreateObject("Scripting.FileSystemObject")
Set oTS = wmiObj.OpenTextFile("{ ** AIR APP INSTALL PATH ** }\META-INF\AIR\publisherid")
publisherid = oTS.ReadAll
Then I get the uninstall executable path/arguments.Set wmiObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{ ** AIR APP ID NAME ** }." & publisherid
strValueName = "UninstallString"
wmiObj.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
I then run the uninstaller: Set wmiObj =
WScript.CreateObject ("WScript.Shell")
wmiObj.run strValue & "
/quiet /qn"
Lastly I remove all leftover files:Set wmiObj = CreateObject("Scripting.FileSystemObject")
Set subFolders = wmiObj.GetFolder("C:\Documents and Settings").SubFolders
For Each folder in subFolders
If wmiObj.FolderExists("C:\Documents and Settings\" & folder.name & "\Application Data{ ** AIR APP ID NAME ** }." + publisherid) Then
'StdOut.WriteLine "Delete: " & "C:\Documents and Settings\" & folder.name & "\Application Data\{ ** AIR APP ID NAME ** }." + publisherid
wmiObj.DeleteFolder("C:\Documents and Settings\" & folder.name & "\Application Data\{ ** AIR APP ID NAME ** }." + publisherid)
End If
Next