Example transition from natively-installed applications to FlexApp layers
Say you have some persistent machines that need some software upgraded but you don’t want to continue doing native installs/upgrades and want to take this opportunity to move some apps to FlexApp packages instead.
One method to accomplish this could be to use a FlexApp pre-activation script to do a command-line uninstall or manual cleanup of the existing application prior to playing back the newly captured FlexApp version. It’s possible that this doesn’t work for all applications and YMMV.
The WMIC command can be useful for this task. You can use the wmic product list command to see the list of installed software and get the exact product name seen in the Description field. Then you can test to see if that software plays nice with a WMIC uninstall call from an elevated cmd prompt: wmic product where name=”Application Name” call uninstall – If the software uninstalls silently, then this can be used as a pre-activation script within the FlexApp package to uninstall the native copy of the application prior to FlexApp playback. There are other options for the query as well, instead of an exact match, you can do a “like match” with wildcards, also. I.e. TightVNC could be done with, wmic product where “name like ‘%%VNC’” call uninstall
Some apps may need a /NONINTERACTIVE flag at the end to do a silent uninstall, other apps may not uninstall at all if this flag is used. Each application may behave differently. The worst-case is you can’t get an uninstall to work and you must use a script to blow away the entire installation structure and reg values like a manual uninstall/cleanup. If the folder structure is gone from disk, most FlexApps will playback and operate just fine despite not being uninstalled using the normal method.
To add a script to a FlexApp package, you must make sure the FlexApp is not assigned in any ProfileUnity configurations or currently being played back by any machines. On the FlexApp Packaging Console, click the Play button next to the app. Once it finishes playing back, click the Edit button and find the “ABC” icon in the dropdown menu. That will bring up the script window. You will need a .BAT file with your commands to insert into the package. Keep in mind that any scripts added to packages get run when editing packages, as well.
*Office and Adobe applications are known to not cleanly uninstall themselves and are not good candidates for this method.