Created
February 3, 2014 15:27
-
-
Save BenNeise/8785837 to your computer and use it in GitHub Desktop.
Powershell function to get PCOIP statistics gatherered via WMI from the target machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PCOIPStatsViaWMI { | |
<# | |
.Synopsis | |
Returns PCOIP statistics via WMI | |
.Description | |
This function displays PCOIP statistics gatherered via WMI from the | |
target machine | |
.Example | |
Get-PCOIPStatsViaWMI -Computer "Computer1" | |
Get PCOIP stats from a single computer | |
.Example | |
Get-PCOIPStatsViaWMI -Computer @("Computer1","Computer2") | |
Get PCOIP stats from one or more computers | |
.Parameter Computer | |
The name of the remote computer. | |
.Notes | |
NAME: Get-PCOIPStatsViaWMI | |
AUTHOR: Ben Neise | |
.Link | |
http://ben.neise.co.uk | |
#Requires -Version 3.0 | |
#> | |
[CmdletBinding()] | |
Param ( | |
[Parameter( | |
Mandatory = $true, | |
Position = 0, | |
ValueFromPipeline = $true, | |
ValueFromPipelineByPropertyName = $true | |
)] | |
[Alias('Name')] | |
[String]$Computer | |
) | |
Begin { | |
$arrResults = @() | |
} | |
Process { | |
ForEach ($strComputerName in $Computer){ | |
Try { | |
Write-Verbose -Message ("Getting WMI information from remoate machine") | |
$objWMIPCoIPSessionGeneralStatistics = Get-WMIObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics" -ComputerName $strComputerName -ErrorAction "Stop" | |
$objWMIPCoIPSessionNetworkStatistics = Get-WMIObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics" -ComputerName $strComputerName -ErrorAction "Stop" | |
$objWMIPCoIPPCoIPSessionAudioStatistics = Get-WMIObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics" -ComputerName $strComputerName -ErrorAction "Stop" | |
$objWMIPCoIPSessionImagingStatistics = Get-WMIObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics" -ComputerName $strComputerName -ErrorAction "Stop" | |
$objWMIPCoIPSessionUSBStatistics = Get-WMIObject -Class "Win32_PerfRawData_TeradiciPerf_PCoIPSessionUSBStatistics" -ComputerName $strComputerName -ErrorAction "Stop" | |
} | |
Catch { | |
Write-Error -Message "Can't get PCOIP information via WMI from $strComputerName" | |
Break | |
} | |
$arrStatistics = @( | |
($objSessionDurationSeconds = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Session Duration Seconds" | |
Description = "An incrementing number that represents the total number of seconds the PCoIP session has been open." | |
Value = $objWMIPCoIPSessionGeneralStatistics.SessionDurationSeconds | |
}), | |
($objBytesReceived = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Bytes Received" | |
Description = "Total number of bytes that have been received since the PCoIP session started." | |
Value = $objWMIPCoIPSessionGeneralStatistics.BytesReceived | |
}), | |
($objBytesSent = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Bytes Sent" | |
Description = "Total number of bytes that have been transmitted since the PCoIP session started." | |
Value = $objWMIPCoIPSessionGeneralStatistics.BytesSent | |
}), | |
($objPacketsReceived = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Packets Received" | |
Description = "Total number of packets that have been received since the PCoIP session started. Note that not all packets are the same size." | |
Value = $objWMIPCoIPSessionGeneralStatistics.PacketsReceived | |
}), | |
($objTXPacketsLost = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "TX Packets Lost" | |
Description = "Total number of transmit packets that have been lost since the PCoIP session started." | |
Value = $objWMIPCoIPSessionGeneralStatistics.TXPacketsLost | |
}), | |
($objRXPacketsLost = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "RX Packets Lost" | |
Description = "Total number of receive packets that have been lost since the PCoIP session started." | |
Value = $objWMIPCoIPSessionGeneralStatistics.RXPacketsLost | |
}), | |
($objPacketsSent = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Packets Sent" | |
Description = "Total number of packets that have been transmitted since the PCoIP session started. Note that not all packets are the same size." | |
Value = $objWMIPCoIPSessionGeneralStatistics.PacketsSent | |
}), | |
($objRoundTripLatencyms = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Round Trip Latency ms" | |
Description = "Round trip latency (in milliseconds) between server and client." | |
Value = $objWMIPCoIPSessionNetworkStatistics.RoundTripLatencyms | |
}), | |
($objRXBWPeakkbitPersec = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "RX BW Peak kbit/sec" | |
Description = "Peak bandwidth for incoming PCoIP packets within a one second sampling period." | |
Value = $objWMIPCoIPSessionNetworkStatistics.RXBWPeakkbitPersec | |
}), | |
($objTXBWActiveLimitkbitPersec = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "TX BW Active Limit kbit/sec" | |
Description = "The current estimate of the available network bandwidth, updated every second." | |
Value = $objWMIPCoIPSessionNetworkStatistics.TXBWActiveLimitkbitPersec | |
}), | |
($objAudioBytesReceived = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Audio Bytes Received" | |
Description = "Total number of audio bytes that have been received since the PCoIP session started." | |
Value = $objWMIPCoIPPCoIPSessionAudioStatistics.AudioBytesReceived | |
}), | |
($objAudioBytesSent = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Audio Bytes Sent" | |
Description = "Total number of audio bytes that have been sent since the PCoIP session started." | |
Value = $objWMIPCoIPPCoIPSessionAudioStatistics.AudioBytesSent | |
}), | |
($objAudioTXBWLimitkbitPersec = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Audio TX BW Limit kbit/sec" | |
Description = "Transmit bandwidth limit for outgoing audio packets as defined by the GPO setting." | |
Value = $objWMIPCoIPPCoIPSessionAudioStatistics.AudioTXBWLimitkbitPersec | |
}), | |
($objImagingBytesReceived = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Imaging Bytes Received" | |
Description = "Total number of imaging bytes that have been received since the PCoIP session started." | |
Value = $objWMIPCoIPSessionImagingStatistics.ImagingBytesReceived | |
}), | |
($objImagingBytesSent = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Imaging Bytes Sent" | |
Description = "Total number of imaging bytes that have been sent since the PCoIP session started." | |
Value = $objWMIPCoIPSessionImagingStatistics.ImagingBytesSent | |
}), | |
($objImagingEncodedFramesPersec = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Imaging Encoded Frames/sec" | |
Description = "The number of imaging frames which were encoded over a one second sampling period." | |
Value = $objWMIPCoIPSessionImagingStatistics.ImagingEncodedFramesPersec | |
}), | |
($objImagingActiveMinimumQuality = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Imaging Active Minimum Quality" | |
Description = "The lowest encoded quality (0 to 100), updated every second. Not to be confused with the GPO setting." | |
Value = $objWMIPCoIPSessionImagingStatistics.ImagingActiveMinimumQuality | |
}), | |
($objImagingDecoderCapabilitykbitPersec = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "Imaging Decoder Capability kbit/sec" | |
Description = "The current estimate of the decoder processing capability." | |
Value = $objWMIPCoIPSessionImagingStatistics.ImagingDecoderCapabilitykbitPersec | |
}), | |
($objUSBBytesReceived = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "USB Bytes Received" | |
Description = "Total number of USB bytes that have been received since the PCoIP session started." | |
Value = $objWMIPCoIPSessionUSBStatistics.USBBytesReceived | |
}), | |
($objUSBBytesSent = [PSCustomObject]@{ | |
Computer = $strComputerName | |
Name = "USB Bytes Sent" | |
Description = "Total number of USB bytes that have been sent since the PCoIP session started." | |
Value = $objWMIPCoIPSessionUSBStatistics.USBBytesSent | |
}) | |
) | |
ForEach ($arrStatistic in $arrStatistics){ | |
$arrResults += $arrStatistic | |
} | |
} | |
} | |
End { | |
Return $arrResults | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment