Author Posts

March 21, 2018 at 8:33 pm

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

March 21, 2018 at 8:53 pm

Got it working...

{$_.SessionUserName -like *$vdiuser}

Thanks
Rob