login vsi company logo login vsi company logo 250x40

 

Get the best possible VDI performance, density and availability with Login VSI
Our Solutions

Warning

JUser: :_load: Unable to load user with ID: 19633

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
Do
{
	$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
Do
{	
	# Collect end of App-V publishing
	$endTime = Get-WinEvent -LogName "Microsoft-AppV-Client/Operational" | Where-Object {$_.ID -eq "19002"} | Select -First 1
	
	#Feedback
	Write-Host "End time:" $endTime.TimeCreated
	
	# If endTime is later then startTime break from loop
	If ($endTime.TimeCreated -gt $startTime.TimeCreated)
	{
		$break = $True
	} 
	else
	{
		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

Results

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

Conclusion

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

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

Popular Blogs

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. 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 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
Login VSI Blog - Teaser Image - A Practical Guide to VDI Change Management - Part 1

A Practical Guide to VDI Change Management

Part 1: IT Change Management in general The first in an 8-part series, this practical guide to VDI Change Management will guide you through the transformation of the IT department from a back-end function into a core competency for every modern organization. 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. Continue Reading
Login VSI Blog - How-To Update, Protect Against RIDL, Fallout MDS Vulnerability

How-To: Update, Protect Against RIDL, Fallout MDS Vulnerability

RIDL & Fallout MDS vulnerabilities, impact on VDI performance & actions to take. FAQs we’re receiving & updates on performance tests executed to patch flaws Intel calls “Microarchitectural Data Sampling (M.D.S.)” aka: Rogue In-Flight Data Load (RIDL), Fallout, ZombieLoad & Store-to-Leak Forwarding. Continue Reading
Cookie Settings