In PVS environments when weak target device performance is encountered, slow boot, slow application opening, there are a several places to check for insights into the source of the problem.
One common source of weak target device performance is an unexpected volume of read requests from target devices. When all booted target devices are simultaneously requesting much larger volumes of reads than normal, it can lead to network saturation, network latency, PVS server over utilization, vdisk storage over utilisation.
When high load on PVS servers is determined as source of the problem, we want to quickly determine if there is a common process on PVS targets consuming reads. To simplify identifying a common source on target devices, a PowerShell script was created which will query PVS targets for the top read consuming processes.
Powershell script example to be run from PVS server.
Replace <site> with the PVS site name, and replace <collection name> with target device collection
The script will query each target device in the device collection and return its up time, and top 5 processes by Reads in GB.
& "$($env:systemroot)\Microsoft.NET\Framework64\v4.0.30319\installutil.exe" "$($env:programfiles)\Citrix\Provisioning Services Console\Citrix.PVS.SnapIn.dll"
Add-PSSnapin *PVS*
$targets = Get-PvsDevice -SiteName <site> -CollectionName <collection name> | select devicename, domainname
foreach ($target in $targets){
$TargetName = "$($target.devicename).$($target.domainname)"
$TopReads = Get-CimInstance -ComputerName $TargetName -ClassName Win32_Process | Select-Object Name,ReadTransferCount | sort -Descending ReadTransferCount | select -First 5
$Uptime = (Get-Date) - (Get-CimInstance -ComputerName $TargetName -ClassName Win32_OperatingSystem).LastBootUpTime
Write-Output "`nPVS target name:`t$($TargetName)"
Write-Output "Uptime: $($uptime.days) days, $($uptime.hours) hours, $($uptime.minutes) minutes"
Write-Output "Processes currently running with top reads in GB:"
foreach ($read in $TopReads){
$ProcessName = "$($read.name)".Padright(25,' ')
$ReadGB = $([math]::round(($read.ReadTransferCount)/1GB, 3))
Write-Output "$ProcessName $ReadGB"
}
}