Thanks for replies. Sorry, I really just cant seem to grasp the API calls for Horizon. I do this kind of stuff daily for AD with PS commands such as get-aduser, set-aduser, etc. For some reason this one is just evading my understanding.
Thanks to the references given above I have almost got what I need. The script below is working perfectly for identifying the VDI sessions I wish to log off. It seems all I am missing is a one liner to log each of the sessions off as they are found? Any advice how to do this?
$sessions=(get-hvlocalsession).namesdata
foreach ($session in $sessions){
if($session.DesktopName -eq "TESTPOOL1"){
Write-Host "Connection to TESTPOOL1 found: " $session.Username
#NEED HELP HERE.... NEED TO ADD LOGOFF COMMAND HERE TO LOG OFF THE SESSION IN QUESTION
}
}