Demo entry 2640474

Get_Data_From_VDA

   

Submitted by anonymous on Sep 07, 2015 at 08:26
Language: PowerShell. Code size: 1.7 kB.

# This powershell script collects the performance metrics from a VDA and writes it to a text file

# Intialise Parameters and create the output file
$LastTimeStamp = "0"
$FileName = "./Output.txt"
New-Item $FileName -type file -force

# Infinte Loop that is cancelled when the benchmark needs to be ended.
# Each loop iteration it checks to see if the statistic has been updated by checking the stored Timestamp with the current one
# If it is different it stores the Timestamp, Frame Rate, Round Trip Time, Input Bandwidth Used, Output Bandwidth Used, Output Bandwidth Available 
# Else nothing
# The program then sleeps for 9 seconds as data is updated every 10 seconds. 

while($True)
    {

    $Stats = gwmi -n root\citrix\euem -cl citrix_euem_RoundTrip

    If($LastTimeStamp -ne $Stats.Timestamp) {
        
        $("Timestamp: " + $Stats.Timestamp) | Out-File -filepath $FileName -Append
        $("Round Trip Time: " + $Stats.RoundtripTime) | Out-File -filepath $FileName -Append
        $("Input Bandwidth Used: " + $Stats.InputBandwidthUsed) | Out-File -filepath $FileName -Append
        $("Output Bandwidth Used: " + $Stats.OutputBandwidthUsed) | Out-File -filepath $FileName -Append
        $("Output Bandwidth Available: " + $Stats.OutputBandwidthAvailable) | Out-File -filepath $FileName -Append
        
        $FrameRate = gwmi -n root\citrix\hdx -cl Citrix_VirtualChannel_Thinwire_Enum
        $("Frame rate:" + $FrameRate.Component_Fps) | Out-File -filepath $FileName -Append
        
        $LastTimeStamp = $Stats.Timestamp
        
        echo "Writing to File"
    } Else {
        echo "It is the same"
    }
    start-sleep 9
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).