unable to manipulate the get-counter information as needed

Welcome Forums General PowerShell Q&A unable to manipulate the get-counter information as needed

This topic contains 3 replies, has 4 voices, and was last updated by

4 years, 2 months ago.

  • Author
  • #21629

    Points: 1
    Rank: Member

    First of all I am new to this forum and this is my first post so if this is not placed in the correct section I apologize. Also I am not an expert at powershell by any means.

    We use CitrixXenApp 6.5. We would like to get some counter information in a simplified format. This counter is the ICA latency counter, I am able to get the information needed but it comes out in a format that I am not able to manipulate into something more usable for our needs. I need it to be formatted into two columns: user and latency counter stats. When I run the command

    get-counter "\\servername\ICA Session(*)\Latency - Last Recorded" 

    I get an output like the following

    Timestamp CounterSamples
    ——— ————–
    1/5/2015 1:40:47 PM \\servername\ica session(_server total)\latency – last recorded :

    \\servername\ica session(ica-tcp 7 (userA))\latency – last recorded :

    \\servername\ica session(ica-tcp 3 (userB))\latency – last recorded :

    \\servername\ica session(ica-tcp 4 (userC))\latency – last recorded :

    \\servername\ica session(ica-tcp 5 (UserD))\latency – last recorded :

    \\servername\ica session(ica-tcp 2 (UserE))\latency – last recorded :

    \\servername\ica session(ica-tcp 6 (UserF))\latency – last recorded :

    \\servername\ica session(ica-tcp 0 (UserG))\latency – last recorded :

    The problem I have is that I am not able to parse out just the username (userA) and the Last recorded: stat.

    I have done a GM and I get the following

    TypeName: Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet

    Name MemberType Definition
    —- ———- ———-
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetType Method type GetType()
    ToString Method string ToString()
    CounterSamples Property Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSample[] CounterSamples {get;set;}
    Timestamp Property datetime Timestamp {get;set;}
    Readings ScriptProperty System.Object Readings {get=$strPaths = ""...

    I tried

    get-counter "\\servername\ICA Session(*)\Latency - Last Recorded"  | select CounterSamples

    {_server total, ica-tcp 7 (UserA), ica-tcp 3 (UserB), ica-tcp 4 (UserC)...}

    This narrows the information down a bit but still not what I need, As you can see it gives me the username and the TCP type but not the counter information.

    I then tried

    get-counter "\\cltcldssgxa01\ICA Session(*)\Latency - Last Recorded" | select readings

    \\cltcldssgxa01\ica session(_server total)\latency – last recorded :...

    I am sure I am missing a very simple solution but for the life of me I am not able to figure it out. Any assistance is greatly appreciated.

  • #21636

    Points: 12
    Rank: Member

    It would be useful to see your
    get-counter \\.... | get-member

  • #21681

    Points: 1
    Rank: Member

    Hi Jessie,

    Please run

    get-counter "\\servername\ICA Session(*)\Latency – Last Recorded" | Select -first 20 | Export-CSV C:\pathto\export.csv

    and place the file here or on Pastebin or some place.

    We need to see your source info to help you at all, and most of us don't have Citrix servers laying about to query.


  • #21708

    Points: 0
    Rank: Member

    I'm terrible at regex but for what it's worth:

    $text = "\\servername\ica session(ica-tcp 7 (userA))\latency – last recorded: 51"
    $NamePattern = '\s\(\w{2,}\)'
    $User = if ($text -match $NamePattern){(($Matches[0].Trim()).TrimStart("(")).TrimEnd(")") }
    $Latency = ($text.Split(":") | Select-Object -Index 1).Trim()
    "User = $User"
    "Latency = $Latency"


    User = userA
    Latency = 51

The topic ‘unable to manipulate the get-counter information as needed’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort