I'm trying to figure out a way to return a list of Horizon sessions with the name of the Secure gateway through which the session is connecting.
When viewing Sessions via the Horizon view admin, its seen the "Secure Gateway" field.
The Get-RemoteSessions doesn't seem to return this field?
Specifically, I would like a list that shows me connected session through the Secure Gateway, then pipe that into a log-off command. That way we can automate a log-off for external users each night, but not affect our internal users.
Which PowerCLI version are you using?
Do a Get-PowerCLIVersion
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have 6.5 release 1 Build 4624819 loaded right now.
The View servers (7.1) have the version installed by View under the "extras" dir. It doesn't return a Get-PowerCLiVersion so I'm not sure is bundled with view 7.1
Strange, the PSSnapin that used to be there with View 5.*, don't work with Horizon View 6.* and 7.*
In fact I don't have these PSSnapin anymore on my Horizon View Connection Servers.
Could these be a relic from a previous View 5.* installation?
In PowerCLI 6.5.1 there is a whole new View module, and a HVHelper module.
Also see Getting Started with PowerCLI for Horizon View
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No, its not a hold over from 5.1
Brand new installs of View 7.x place the add-snapin.ps1 to the extra directory on the view server. C:\program files\VMware\VMWare View\server\extra\powershell which calls the \bin\PowershellServiceCmdlets.dll has a file version of 7.1.0.20598
The server I'm testing with right now was installed fresh with 7.1 only a few weeks ago
But, either way, I was using the HVHelper module on my local copy of PowerCli and I wasn't able to return the secure gateway field.
I'll install any version of PowerCli available if need be.
Yes, the two .ps1 files are still there in the Extras folder, but not the PSSnapin.
That's what I wanted to say.
I'll check if I can retrieve the Secure Gateway somewhere.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok. reviving this thread.
I started playing with this again.
Using the following
$query
.queryEntityType =
'SessionLocalSummaryView
$Sessions
=
$query_service
.QueryService_Query(
$ViewAPI
,
$query
)
I can then use this to return the session username and the securegatewayDNS
$Sessions.Results.NamesData
But this does not return the session status (ie connected or disconnected).
This one does show the connected/disconnect but not the username or machine id.
$Sessions.Results.SessionData
How do I combine these so I can see Username,MachineName, SecurityGatewayDNS and the Session status?
What I'm ultimately trying to do is find all sessions in a "connected" state that do NOT have a securitygatewayDNS and then log them off.
So if the user comes in via the Securitygateway, they are not logged off. But non-secure gateway session that are connected will get forced off. Disconnected states can remain.
Did you ever get this figured out?
Did you figure this out? I'm looking for exactly the same solution.