I am attempting to write a powershell script that will log off the oldest of duplicate connected session. The part that I am stuck at, is getting to the point to log off the duplicates.
Here is what I have:
Add-PSSnapin Citrix.* –erroraction SilentlyContinue
foreach ($session in Get-XASession -Full | Group-Object ClientName | ? { $_.Count -gt 1 })
{
write $session
}
With the above code, it will group the duplicate users (there are probably 3 or 4 different duplicates). How would I take generated information, create an array of just the grouped items and then compare the Log on time (this is retrieved from $session.LogOnTime) to log off the oldest (Stop-XASession $session.SessionId)?
Any help would be very much appreciated.