You can create a Custom Data Class and use the following powershell script to execute against your machines. The script will return the Seesion, User and Active status.
#************************DO NOT EDIT********************************
$nse = New-Object -com Altiris.AeXNSEvent
$nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
$nse.Priority = 1
#************************DO NOT EDIT********************************
#Modify this varaible with the custom data class guid
$strDataClassGuid = "{Custom Data Class Guid Goes Here}"
$objDCInstance = $nse.AddDataClass($strDataClassGuid)
$objDataClass = $nse.AddDataBlock($objDCInstance)
#Add new row of data
$objDataRow = $objDataClass.AddRow()
function Get-TSSessions {
param(
$ComputerName = "localhost"
)
qwinsta /server:$ComputerName |
#Parse output
ForEach-Object {
$_.Trim() -replace "\s+",","
} |
#Convert to objects
ConvertFrom-Csv
}
$session = Get-TSSessions -ComputerName "localhost" | ? { $_.State -eq 'Active' } | Select-Object SessionName | %{$_.SessionName}
$user = Get-TSSessions -ComputerName "localhost" | ? { $_.State -eq 'Active' } | Select-Object UserName | %{$_.UserName}
$state = Get-TSSessions -ComputerName "localhost" | ? { $_.State -eq 'Active' } | Select-Object State | %{$_.State}
$objDataRow.SetField(0, $session)
$objDataRow.SetField(1, $user)
$objDataRow.SetField(2, $state)
#Send the data
$nse.SendQueued()