login vsi company logo login vsi company logo 250x40

Measure Microsoft App-V publishing time with Login PI

Measure Microsoft App-V publishing time with Login PI

Microsoft App-V is a great way to virtualize applications and publish them to the desktop. But App-V publishing can take some time and the application is not always available immediately. This can interfere with a Login PI workload. If the workload attempts to launch applications that haven’t been published to the desktop yet, this will result in application start timeouts reported by Login PI. In this blog post I will describe how to integrate App-V publishing in a Login PI workload.

By combining the script in this blog post with your Login PI workload, you will also be able to measure the App-V publishing time, receive reports about this in the Login PI web interface, and generate alerts and notifications when App-V publishing is not performing as expected.

Script for App-V publishing

With a PowerShell script we can make sure that the workload will wait until App-V publishing is done. By using Windows Forms within the PowerShell script we can detect this in the Login PI workload. In the end, Login PI will report how long it takes for publishing to take place from a user perspective.

The first step is to load the assembly for Windows Forms. This will be used for creating a form that will be detected by the workload.

# Load assembly
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null

Now we will need to store the current date and time within a variable to make sure that we collect the last start publishing event.

# Get current date / time
$currentTime = Get-Date

Next, we can create a loop that monitors the Windows Event Log looking for the last start publishing event with ID 19001.

# Collect App-V publishing startTime
	$startTime = Get-WinEvent -LogName "Microsoft-AppV-Client/Operational" | Where-Object {$_.ID -eq "19001"} | Select -First 1
} While ($startTime.TimeCreated -gt $currentTime)
Write-Host "Start time:" $startTime.TimeCreated

This event indicates that publishing has started. Next we will have to wait until publishing is done. This is also done by using a while loop. When the publishing event with ID 19002 is found which contains a more recent date and time stamp as the start event, we can break out of the loop.

# Break variable for loop
$break = $False
# Do loop until publishing is done
	# Collect end of App-V publishing
	$endTime = Get-WinEvent -LogName "Microsoft-AppV-Client/Operational" | Where-Object {$_.ID -eq "19002"} | Select -First 1
	Write-Host "End time:" $endTime.TimeCreated
	# If endTime is later then startTime break from loop
	If ($endTime.TimeCreated -gt $startTime.TimeCreated)
		$break = $True
		Start-Sleep -Milliseconds 500
} While ($break -eq $False)

To determine if publishing was successful we can use the same method that I recently published on my personal blog: Detect App-V publishing timed out.

# Collect end code to check if publishing has a timed out
$endTimeMessage = $endTime.Message
$endTimeCode = [regex]::match($endTimeMessage, "(.*)Return.*$", "Multiline")
$endTimeCharPos = $endTimeCode.Value.IndexOf("-")
$endTimeCode = $endTimeCode.Value.Substring($endTimeCharPos +1) -replace " ", ""

Based on the exit code a pop-up will appear so this can be detected by the Login PI workload.

if ($endTimeCode -eq "0x80072EE2")
	#Show popup for app_start of Login VSI or Login PI
	[System.Windows.Forms.Messagebox]::Show("The operation timed out", "Timeout")
} else
	#Show popup for app_start of Login VSI or Login PI
	[System.Windows.Forms.Messagebox]::Show("App-V Publishing is done", "App-V")

This script can be stored on the Login PI share. I created a directory named scripting on my share where I stored the script which is accessible for all Login PI users.

Workload integration

Login PI uses a text-based workload language which can be edited. This workload contains a prepare section which contains basic actions that needs to be done, like adding registry settings. Within the prepare phase we can add the script that we created in the previous step.

Open the workload file and add the following line on top of the prepare phase.

# Start App-V script for publishing time
App_Start("AppV", "", "Powershell.exe", "Title", "App-V", "", "-File %VSI_Share%\scripting\AppV.ps1")
App_Close("AppV", "Title", "App-V")

Configure the created workload within the workload settings and start the job. The workload engine will execute the script which is visible within the session.

measure microsoft app v publishing time with login pi script


The engine will report the App-V publishing time by the workload action name "AppV" within the dashboard and the charts page.

measure microsoft app v publishing time with login pi dashboard

If the App-V publishing server is down for some reason, publishing will not take place and this will be reported by Login PI as a timeout. This timeout is visible within the dashboard and alerts page.

measure microsoft app v publishing time with login pi timeout

measure microsoft app v publishing time with login pi dashboard timeout


By using the script in this blog, it’s very easy to integrate App-V publishing time with Login PI. Now you will be able to receive reports about App-V publishing time in the Login PI web interface, and generate alerts and notifications when App-V publishing is not performing as expected. If you have any further questions or need any help to configure this, please feel free to contact us via the forums, or at support@loginvsi.com.

About the author

Ryan Bijkerk (@Logitblog) is a Product Owner at Login VSI and a Microsoft MVP on Application Virtualization (App-V) technology. He is also involved in the independent research Project VRC and speaks at events. Besides working, Ryan enjoys writing for his blog and riding his MTB.

Tags: How-to, Login PI, Microsoft, Application Virtualization, Monitoring, Best Practices, Support, Scripts

Popular Blogs


The VDI Performance Summit - Virtual Conference and Expo

Visit the VDI Performance Summit to gain knowledge and experience about performance and tuning VDI, improving End-User Experience and IT service. Join us at the ONLY virtual event 100% dedicated to VDI performance and tuning | May 2, 2019 This 1-day event offers key-notes presented by the best VDI performance experts in the world, technical and business oriented breakout sessions, the possibility to chat with experts directly to discuss your own situation, and a virtual exhibit hall featuring… Continue Reading

Scalability testing Parallels Remote Application Server with Login VSI

Recently I went to VMworld in Barcelona where Login VSI had a booth on the expo... While I can’t remember exactly how many conversations I had - there had been so many that I lost my voice on day one. What was new this year is that quite a few people asked if our software is compatible with the solutions from Parallels specifically their Remote Application Server (RAS) (Datasheet). Continue Reading
Login VSI Blog Article - Microsoft Windows 10 Default FTA Associations - Teaser Image

Windows 10 Default File Type Associations and Login VSI

When Login VSI 4.1 was released, the majority of desktops were running Windows 7 and life was easy. We’d set the default filetype for an application and it would simply work. The default and industry standard workloads in Login VSI include launching and using Adobe Reader as part of the virtual user simulation. Because Login VSI doesn’t always know which version of Adobe Reader is installed, or where it’s installed, the workload relies on the file type association (FTA) for .pdf documents to be… Continue Reading
Login VSI - Press Release - IGEL - Login VSI Partner to Optimize End User Computing Experience Image

[Press Release] IGEL Partners with Login VSI to Optimize the End User Computing Experience

Login PI enables organizations to better protect the performance and availability of their IGEL OS-powered virtual desktop environments San Francisco, USA, Feb. 6, 2019: IGEL, a world leader in software-defined endpoint optimization and control solutions for the secure enterprise, today announced that it is partnering with Login VSI, provider of software solutions to test and actively monitor the performance and availability of virtual desktop environments, including VDI and… Continue Reading
Login VSI - Blog - Login PI Blog Teaser Image - Windows Virtual Desktop: How To Monitor User Experience With Login PI

Windows Virtual Desktop – How to Monitor User Experience?

Microsoft has just announced the public preview of their new Windows Virtual Desktop (WVD) offering at Microsoft Ignite on Tour in Amsterdam today. For those of you who’ve not followed the rumors or the private beta, here’s the outline... Continue Reading
Investigating Online Application Performance with Login PI

Investigating Online Application Performance with Login PI

As many companies do, we use a CRM system. Recently, I have been getting complaints about our cloud CRM system, Microsoft Dynamics, being slow. I tried to investigate this by shadowing one of our users to see what was wrong. As expected, everything was fast. 15 minutes later, the same user reported slowness again. How could I investigate this without bothering the users? Continue Reading
Cookie Settings