App-V 5.0 Demo – Uninstall a Native Application

Posted on Updated on

This is the walkthrough for demo #1 in my Microsoft Master webcast on App-V 5.0 scripting.  For the full webcast information, visit https://t3chn1ck.wordpress.com/2014/02/03/playback-of-microsoft-master-app-v-5-0/.

This demo is on uninstalling native (local) applications when an App-V package is added to a system.  For this example, I used 7-zip.

1)  First, sequence your application (7-zip).  Nothing special to do, just make sure it’s been done ;-)

2)  Create a .bat file to perform the uninstall of the software.  In this case, I just looked up GUID of the package to have msiexec perform the uninstall and added an extra step to then echo “Removed 7zip” into a text file for evidence that the script executed.  So my batch file looks like below.

Note: that you don’t have necessarily have to do this uninstall so simply as I have .. or even use a .bat script.  It could be VBScript.  Or PowerShell.  And/or include any custom checks to make sure it gets removed.  And the options go on.


MsiExec.exe /x {23170F69-40C1-2702-0920-000001000000} /qb

echo Removed 7zip >> C:\uninst_7zip.txt

3)  Save your .bat file onto a server share.  This share needs to have read, list, execute rights for all users and all computers of the domain.  In my examples, I essentially just had the share as \\server\AppV_Scripts\ which I can use for other scripts and whatnot.

4)  Edit the DeploymentConfig.xml file of the AppV package.  What we want to do is

  1. Locate the <MachineScripts> section – uncomment the blocked text so it can used
  2. Locate the <AddPackage> element and delete the rest of the elements
  3. Set the <Path> to execute cmd.exe on the system
  4. Set the <Arguments> to run the .bat file on the server; if you’re unaware /c means to cmd.exe to “run this command” which would then be your \\server\share\script.bat

<!-- Machine Scripts Example - customize and uncomment to use machine scripts -->
<MachineScripts>
<AddPackage>
<Path>cmd.exe</Path>
<Arguments>/c \\alderaan2\appv_scripts\uninst_7zip.bat</Arguments>
<Wait RollbackOnError="true" Timeout="30"/>
</AddPackage>
</MachineScripts>

5)  Now we’ll add the package into ConfigMgr as an Application.  Note that ConfigMgr will choose the most recently modified Config.xml file to use for the Deployment Type.

  1. Add a new Application7zip-demo-01
  2. Select to add an App-V 5.0 package and select the .appv file7zip-demo-02
  3. Complete the wizard
  4. Using standard ConfigMgr procedures, deploy the application to the desired user collection (or computer)
  5. Run the application from the targeted user’s Application Catalog7zip-demo-03
  6. Watch the local system as the natively installed application is removed and replaced by the AppV package is there!
  7. Then check that the C:\ for presence of the uninst_7zip.txt file thus giving further proof that script executed!
Advertisements

3 thoughts on “App-V 5.0 Demo – Uninstall a Native Application

    App-V 5.0 Demo – Application Shims | t3chn1ck said:
    February 10, 2014 at 7:18 pm

    […] « App-V 5.0 Demo – Uninstall a Native Application […]

    Playback of Microsoft Master App-V 5.0 | MS Tech BLOG said:
    February 16, 2014 at 2:21 pm

    […] App-V 5.0 Demo – Uninstall a Native Application | t3chn1ck […]

    Playback of Microsoft Master App-V 5.0 | t3chn1ck said:
    July 10, 2015 at 6:43 am

    […] App-V 5.0 Sequencing Decision Matrix App-V 5.0 Demo – Uninstall a Native Application […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s