Powershell script example to be run from PVS server.
Replace <collection name> with target device collection.
Script will qeury each target device in the device collection and return its up time, and top 5 processes by Reads in GB.
& “$($env:systemroot)Microsoft.NETFramework64v4.0.30319installutil.exe” “$($env:programfiles)CitrixProvisioning Services ConsoleCitrix.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”
}
}