I want to display current Citrix-sessions and the following AD-information for the users:
Name (From AD), streetAddress (From AD), physicalDeliveryOfficeName (From AD), DeviceId (From Citrix), LaunchedViaHostName (From Citrix)
These lines get me the Citrix session information I need:
------
Asnp Citrix.*
Import-Module ActiveDirectory
$users = Get-BrokerSession |select -uniq UserUPN, DeviceId, LaunchedViaHostName
-----
After those commands I have the following information in an array $users:
Because I now have the UserUPN information available, I should be able to map it to AD accounts to get more information. I try to get the information displayed with these commands:
foreach ($i in $users) {
Get-ADUser -LDAPFilter "(userprincipalname=$i.UserUPN)" -properties physicalDeliveryOfficeName, streetAddress | select name, streetAddress, physicalDeliveryOfficeName, $i.DeviceId, $i.LaunchedViaHostName |sort-object physicalDeliveryOfficeName
}
But Ill get an error:
select : The value of a parameter was null; one of the following types was expected: {System.String, System.Management.
Automation.ScriptBlock}.
At line:2 char:113
+ Get-ADUser -LDAPFilter "(userprincipalname=$i.UserUPN)" -properties physicalDeli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Select-Object], NotSupportedException
+ FullyQualifiedErrorId : DictionaryKeyUnknownType,Microsoft.PowerShell.Commands.SelectObjectCommand
If I use this command, it works, but then I cannot display DeviceId and LaunchedViaHostName information:
$users.userupn | %{ Get-ADUser -LDAPFilter "(userprincipalname=$_)" -properties physicalDeliveryOfficeName, streetAddress} | select name, streetAddress, physicalDeliveryOfficeName |sort-object physicalDeliveryOfficeName
- Edited by hafka 1 hour 48 minutes ago