Category Archives: App-V

Update to AppV launcher for Version 5

Just a quick note to say I’ve updated the AppV launcher tool to support Appv 5.

appv5

 

The app-V launcher tool is a self contained executable which lists your installed App-V packages and allows you to launch an executable in that virtual applications environment. This is particularly useful if you or your admins / users are not PowerShell friendly or you would prefer to not publish PowerShell scripts as programs.

You can get a copy of the latest version and/or it’s source code over here.

As an added benefit I’ve included source code for running PowerShell commands in .Net, so if you are interested in trying to do so grab the source code!

The idiots guide to load balancing App-V LWS via a Citrix Netscaler:

I set about recently to load balance app-v lightweight streaming servers traffic across Netscalers. I found this task a little more tricky than I had hoped and decided it would be useful to break this task down to its most basic steps and publish this to help anyone else who needs to do this in future.

Despite great articles on Technet and hakabo.com, the sooner doesn’t have any fault tolerance for RTSP specific issues and focuses on the command line, which many administrators morbidly fear on the Netscaler. The later is geared at management servers which have slightly different requirements to LWS servers, the monitor recommended utilises commands which the LWS server does not support. Which results in downstate App-V servers at all times.

So below you will find an idiot proof guide (tested by this idiot) to marry two of my favourite pieces of technology into a kick ass solution.

What you will need:

  • Netscalers!
  • at least 2 App-V Light Weight streaming servers!
  • One netscaler Virtual IP address to load balance the traffic
  • About 30 minutes of time (including testing).

1: To start, take a note of the ip addresses currently configured on your App-V LWS servers.

2: Log into your wonderful netscalers.

First up, we’ll configure the monitor. This monitor will poll your App-V servers and ensure they are up and working.

3: From the configuration page, select Load Balancing > Monitors > Add:

4: Name the monitor something specific and easily identifed, then configure the below options:

  • type = RTSP
  • Interval =20
  • Destination port = 554

5: Click the Special Parameters tab, Then set the below values:

  • RTSP Request = Options *
  • Response Codes: 401

(yes yes, 401 is an error response, but the LWS server has to be actively accepting connections to throw this error)

6: Once finished, hit Create:

And that’s it, monitor configured!

Next, we’ll create a service group, this service group is a logical collection of our App-V servers. Here we will configure the ports and monitoring configuration to catch outages.

7: Browse to Load Balancing > Service Groups, then choose Add:



8: Name the Service group something specific and easily identifed, then define the following options:

  • Protocol = Any

9: Enter each IP address of the App-V server, ensure to choose * as the port and click Add. Repeat this step for each subsequent App-V server.

10: Once you’ve entered all your IP addresses, it should look as below: (ip addresses omitted)

11: Now flick to the Monitors tab and select the service group we created earlier:

12: Once finished, save your changes, the service group is done.

We’re on the home straight, now we’ll tie it all to a virtual IP and configure the load balancing specific settings:

13: Now to the Virtual server, browse to Load Balancing > Virtual Servers > Add.

14: Name the Virtual Server something specific and easily identifed, then define the following options:

  • Protocol = Any
  • IP address = the virtual ip address to be hosted by the netscaler.
  • Port = *

15: Flick to the Service Groups tab, then select the service group we just created:

16: Flick to the Method and Persistence tab, then configure the following options:

  • Method = Least connection
  • Persistence = Source IP
  • ipv4 Netmask = 255.255.255.255

17: Now flick to the Advanced tab, then configure the following options:

  • Redirection mode = IP Based

Thats it, we’re done! time to test.

18: Open up a telnet client, and attempt to telnet to the newly configured virtual server:

19: If all has gone to plan, the window should empty its contents and appear as below:

20: Now go celebrate your success and genius. If for some reason it has not worked, feel free to drop a comment and I’ll see what I can assist you with.

Automating Microsoft App-V Lightweight Streaming Services with Powershell.

App-V Lightweight streaming services (LWS) is awesome. In particular, its a great utility for enterprises who wish to use App-V but don’t need the user management overhead that comes along with the full product.

For example, when using something brilliant like RES Workspace Manager, you can provision App-V applications, manage licensing requirements and restrict access to applications to pretty much any collection you wish. With utilities like this managing your workspaces the App-V database and management servers are just unnecessary add-ons.

With Lightweight streaming services, you get all the benefit of isolation, streaming and version control but without the additional infrastructure and management overhead. Simply host a network based application depot and point the lightweight streaming servers / clients to the share, Done.

But even with all these great benefits, the key difficulty with Lightweight streaming services is pre-caching the applications before a user needs them and keeping the application content up to date as new updates are added.

Having scripted mechanisms in Batch to perform this function and lost some hair in the process, I’m delighted to say PowerShell handles this job really well. Below find the powershell functions I’ve written to handle the four core tasks and the script I use to tie them all together. I run this script as a startup script after our XenApp servers scheduled restarts, this script will:

  • delete local packages that no longer exist on the content share.
  • Add new packages on the content share.
  • Perform a version check, deleting a local older copy if found.

Note: These scripts assume best practices of the applications being stored in servernamecontentshareappnameapp files.
Add an appv package to the local machine:
Useage:  add-appvpackage -path “servercontentshare” -packagename “packagename”

function add-appvpackage{
    param(
        [string]$path,
        [string]$packagename)
       if (test-path $path$packagename$packagename`_manifest.xml){
            pushd $path
            start-process -wait sftmime.exe -argumentlist "add package:$packagename /manifest .$packagename$packagename`_manifest.xml /global"
            start-process -wait sftmime.exe  -argumentlist "load package:$packagename"
            popd
          }#end path if
       Else{
       write-warning "problem with path $path$packagename$packagename`_manifest.xml"}
}#end function

Remove an appv package to the local machine:
Useage: remove-appvpackage -packagename “packagename”


function remove-appvpackage{
    param(
        [string]$packagename)
    start-process -wait sftmime.exe -argumentlist "delete package:$packagename /global"
}

Retrieve a list of appv packages on the local machine:
Useage: get-appvlocalpackages

function get-appvlocalPackages{
    $localpackageswmi = get-wmiobject -class Package -namespace rootmicrosoftappvirtclient
    foreach ($package in $localpackageswmi) {
        $packagedetails = New-Object PSObject -Property @{
                Name=$package.Name
                Version=$package.version
                VersionGuid="`{$($package.versionguid)`}"
            }#end object
        $packages+=@($packagedetails)
    }#end for
    return $packages
}#end function

Retrieve a list of appv packages on the content share:
Useage: get-appvremotepackages

function get-appvremotepackages{
    param(
        [string]$remotedir="computernamecontentshare")

    foreach ($package in get-childitem $remotedir){
        [xml]$manifest = get-content $remotedir$package${package}_manifest.xml
        $packagedetails = New-Object PSObject -Property @{
            Name=$manifest.package.Name
            Version=$manifest.package.version
            VersionGuid=$manifest.package.versionguid
        }#end object
        $packages+=@($packagedetails)
    }#end for
    Return $packages
}#End Function

Gluing it all together into a maintenance script:

#getting package arrays
$locallist=get-appvlocalpackages | sort name
$remotelist=get-appvremotepackages | sort name

#sort the differences to highlight deletes first.
foreach ($difference in COMPARE-OBJECT -referenceobject $locallist -differenceobject $remotelist -property name,version | sort sideindicator){
    if ($difference.sideindicator -eq "<="){
        if ($difference.name -ne $null){
            write-host "removing $($difference.name)"
            remove-appvpackage -packagename $difference.name}
    }#end if
    Else {
        if ($difference.name -ne $null){
            "adding $($difference.name)"
             add-appvpackage -path $remotedir -packagename $difference.name}   
        }#end else
}#end for

To grab a copy of the whole script, follow the jump below:

Continue reading

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

App-V Launcher, an application to quickly troubleshoot in the App-V bubble.

Note: This post has been updated to include an executable for AppV 5 along with the source code if you wish to see how to interact with powershell from .Net.

So here’s your scenario, you’re knee deep in an App-V roll out and a user reports a bizarre issue with a virtual application. You need to get into the bubble to have a look around and the process normally goes something like this:

  • “what’s that command again?”
  • open up a browse and search for it… oh yes, its “sfttray.exe /exe cmd.exe ” and the application name at the end…
  • what’s the application name? oh yes, its a combination of the original application name and the particular version number… “theres no way I can remember that!”
  • launch the sftcmc.msc, and try to find the correct application out of a potentially very long list.
  • copy the name into the command line and pray you don’t close that cmd window soon.

This process always slows me down, so I wrote the following little program to get over this issue, enter App-V Launcher:

This application enumerates cached Microsoft App-V applications and presents you with a list to choose from. Once you select the application you want to work with, you can simply type the executable you need to use inside of the bubble and you can troubleshoot to your hearts content.

Below you’ll find the pre req’s, supported platforms and download. I’ve also included the source code should you need to tweak it to suit your implementation.

I have tested this on:

  • Windows server 2008 r2 with App-V 4.6 sp1
  • Windows server 2003 r2 (x86) with App-V 4.5

Prerequisites:

  • Microsoft .Net framework 3.5 (.Net 4.0 for appv 5 launcher)
Download:

Updated for App-V 5:

I’ve updated the package for app-v 5, cleaner UI and now relies on the powershell commands.

appv5