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

Related Posts

New Module: Creating an RDP file password with Pow... Here's something that is surprisingly tricky to automate in this day and age. Creating a password and storing it in an RDP file. I'm not here to debat...
Dealing with multi numbered versions in powershell... So here's a quick little blog about something i discovered in powershell while googling today. Lots of vendors like to use version numbers includin...
Accurately checking the Citrix PVS “cache in... Citrix Provisioning services "Cache in RAM, overflow to disk", even with it's challenges is something I've always felt was a great idea, hell, I fores...

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