Variable for username with \ not working

This topic contains 1 reply, has 1 voice, and was last updated by  Rob Jaudon 2 months ago.

  • Author
    Posts
  • #96678

    Rob Jaudon
    Participant

    All,

    I am trying to query the Citrix environment to find out what VDI they are connected to.

    I envision the script to be run with a parameter in which the user supplies the username in the form of first.last

    The problem I'm running into is in the CTX environment the user is presented in the form of domain\username (contoso\Jimi.Hendrix) and I can't seem to get the variable to populate in the script.

    I believe it is because the SessionUserName is having an issue with the '\'

    c:\FindCtxuser.ps1 jimi.hendrix

    Property to query on:

    SessionUserName : contoso\Jimi.Hendrix

    param(
    [array] $vdiusers
    )
    write-host userName = $vdiusers
    foreach($vdiuser in $vdiusers)

    {
    Get-BrokerDesktop -adminaddress CitrixDDCName -MaxRecordCount 9000|Where-Object {$_.SessionUserName -like $vdiuser}|
    Sort-Object SessionUserName|Format-Table SessionState,SessionUserName,DesktopGroupName

    Any help would be appreciated.
    Rob Jaudon

  • #96686

    Rob Jaudon
    Participant

    Got it working...

    {$_.SessionUserName -like *$vdiuser}

    Thanks
    Rob

You must be logged in to reply to this topic.