Variable for username with \ not working

Welcome Forums General PowerShell Q&A Variable for username with \ not working

This topic contains 1 reply, has 1 voice, and was last updated by

11 months ago.

  • Author
  • #96678

    Points: 0
    Rank: Member


    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

    [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

    Points: 0
    Rank: Member

    Got it working...

    {$_.SessionUserName -like *$vdiuser}


The topic ‘Variable for username with \ not working’ is closed to new replies.

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