Automation

 View Only
  • 1.  send a message to VDI pool

    Posted Oct 19, 2022 09:52 PM

    HI

    Looking for a script where I can send a message to a specific VDI pool, any help appreciated 

    Thanks a bunch



  • 2.  RE: send a message to VDI pool

    Posted Oct 20, 2022 06:05 AM


  • 3.  RE: send a message to VDI pool

    Posted Oct 20, 2022 01:14 PM

    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



  • 4.  RE: send a message to VDI pool

    Posted Oct 20, 2022 02:47 PM

    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



  • 5.  RE: send a message to VDI pool

    Posted Oct 20, 2022 03:36 PM

    Did the connect-hvserver -server 10.10.10.10 return an object indicating success?



  • 6.  RE: send a message to VDI pool

    Posted Oct 20, 2022 04:25 PM

    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



  • 7.  RE: send a message to VDI pool
    Best Answer

    Posted Oct 20, 2022 04:52 PM


  • 8.  RE: send a message to VDI pool