Quickly delete and re-stream an App-V application with Powershell

I get this problem quite a bit in our environment so threw together a quick Powershell script.

A tech will add revision after revision to an App-V package in the development lifecycle, but when it goes live to production the revisions are so far apart the application rarely works using the cached version even after an sfttray /loadall.

Here’s a quick Powershell script to cleanly remove and read an application:

The usage is below:

update-appvpackage -path "servercontentshare" -package "packagename"

This script assumes you use the best practices on your content share. .e.g. contentshareappnameappname_manifest.xml. If you don’t use this practice, this script wont work for you.

function update-appvpackage{
    param(
        [string]$path,
        [string]$packagename)

    if (test-path $path$packagename){
            pushd $path
            write-host "deleting $packagename"
            start-process -wait sftmime.exe -argumentlist "delete package:$packagename /global"
            write-host "Re-Adding $packagename"
            start-process -wait sftmime.exe -argumentlist "add package:$packagename /manifest .$packagename$packagename`_manifest.xml /global"
            write-host "Loading $packagename"
            start-process -wait sftmime.exe -argumentlist "load package:$packagename"
            popd
          }#end path if
     Else {
        write-warning "package directory / path not found"}
}#end function

2 Comments About “Quickly delete and re-stream an App-V application with Powershell

  1. Arthur

    Great script, but I want to delete it from a local computer that is having app problems with an app-v and refresh the app-v server. Any thoughts?

    Reply
    1. Andrew Morgan

      Hi Arthur,

      I’m afraid I dont have an App-V installation to hand.

      have you tried sfttray /refreshall after deleting the application? or sftmime refresh server:servername?

      Reply

Leave a Reply