HI
Looking for a script where I can send a message to a specific VDI pool, any help appreciated
Thanks a bunch
The error looks similar to the issue in Solved: Re: VMWare View API - VirtualCenterHealth - Sessio... - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you try the code in Send messages to active connections on Horizons us... - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
HI L.
I did try the following after your suggestion:
$hvserver = connect-hvserver -server 10.10.10.10
$hvservices=$HVServer.ExtensionData
$sessions=get-hvlocalsession
$Poolname="IO"
foreach ($session in $sessions){
if($session.DesktopName -eq "$Poolname"){
$sessionId = $session.Id
Write-Host "Connection to $Poolname found: " $session.username
$hvservice.session.Session_SendMessage($sessionid,"INFO","TEST")
}
}
I ran this and even though I got no error whatsoever, The message does not show on the VDI
Thanks a bunch
L
after fixing a few things that works on my env. I ended with the following:
foreach ($session in $sessions){
if($session.NamesData.DesktopName -eq "$Poolname"){
$sessionId = $session.Id
Write-Host "Connection to $Poolname found: " $session.username
$hvservices.session.Session_SendMessage($sessionid,"INFO","We are performing a disk expansion on the IO VDI pool, we would like this to happen as soon as the CHG is approved")
}
}
But I get the following error:
Exception calling "Session_SendMessages" with "3" argument(s): "ExceptionType : VMware.Hv.SecurityError
ErrorMessage : Session is not authenticated"
At line:8 char:7
+ $hvservices.session.Session_SendMessages($sessionid,"INFO","We ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException
what am I missing
Thanks a bunchhh
Did the connect-hvserver -server 10.10.10.10 return an object indicating success?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I think it did , as when I don't I usually get an error
also I don't know if this is a good indicator but when I ran $sessions , I get a list of all :
VMware.Hv.SessionId VMware.Hv.SessionNamesData VMware.Hv.SessionLocalReferenceData VMware.Hv.SessionData, taking there is a connection established to the connection server correct?
hope this help
Thanks a bunch
The error looks similar to the issue in Solved: Re: VMWare View API - VirtualCenterHealth - Sessio... - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
use rest api's Sending messages to Horizon Sessions using Powershell & REST api’s – Retouw.nl