<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PowerCLI script to send message to all desktops in a specific pool in Horizon Desktops and Apps</title>
    <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845192#M93865</link>
    <description>&lt;P&gt;Look at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stephenjesse.com/2020/09/16/script-for-automating-desktop-logoffs-in-horizon/" target="_blank" rel="noopener"&gt;http://stephenjesse.com/2020/09/16/script-for-automating-desktop-logoffs-in-horizon/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;its what I use. I email and send a local message and that seems to be working.. It looks similar I'd compare and also make sure your powercli version is updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$global:DefaultHVServers[0].ExtensionData.Session.Session_SendMessage($session.id,$emailSubject,$emailBody)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 14:48:11 GMT</pubDate>
    <dc:creator>sjesse</dc:creator>
    <dc:date>2021-05-03T14:48:11Z</dc:date>
    <item>
      <title>PowerCLI script to send message to all desktops in a specific pool</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845189#M93864</link>
      <description>&lt;P&gt;I am working on a PowerCLI script that will filter all sessions within a specific Horizon pool, send a warning message to those filtered sessions via the Session_SendMessage API call, then wait a certain amount of time before logging them off. The filtering and logging off portion does not seem to be the issue, but rather the Session_SendMessage portion. Here is what I have so far:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Connect-HVServer &amp;lt;server&amp;gt;&lt;BR /&gt;$Services1 = $Global:DefaultHVServers.ExtensionData&lt;BR /&gt;$Sessions = (Get-HVLocalSession).NamesData&lt;BR /&gt;ForEach ($Session in $Sessions) {&lt;BR /&gt;IF ($Session.DesktopName -eq "TEST") {&lt;BR /&gt;Write-Host `n "Connection to TEST found" $Session.Username }&lt;BR /&gt;$Services1.Session.Session_SendMessage($session.id, "INFO", "Your session will be logged out in 10 minutes for maintenance. Please save your work!")&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to confirm that $Sessions variable was working correctly I threw in the the Write-Host portion. In the TEST pool I have specified, I do get a return (there is only one session logged into that pool at the moment). The problem is what follows after the API call:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="curtistcreps_0-1620052410293.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/88582iD3629A1214858849/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="curtistcreps_0-1620052410293.png" alt="curtistcreps_0-1620052410293.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not entirely sure what I'm doing wrong...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:39:12 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845189#M93864</guid>
      <dc:creator>curtistcreps</dc:creator>
      <dc:date>2021-05-03T14:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI script to send message to all desktops in a specific pool</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845192#M93865</link>
      <description>&lt;P&gt;Look at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://stephenjesse.com/2020/09/16/script-for-automating-desktop-logoffs-in-horizon/" target="_blank" rel="noopener"&gt;http://stephenjesse.com/2020/09/16/script-for-automating-desktop-logoffs-in-horizon/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;its what I use. I email and send a local message and that seems to be working.. It looks similar I'd compare and also make sure your powercli version is updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$global:DefaultHVServers[0].ExtensionData.Session.Session_SendMessage($session.id,$emailSubject,$emailBody)&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 14:48:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845192#M93865</guid>
      <dc:creator>sjesse</dc:creator>
      <dc:date>2021-05-03T14:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: PowerCLI script to send message to all desktops in a specific pool</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845198#M93866</link>
      <description>&lt;P&gt;Thanks for the quick response.&lt;/P&gt;&lt;P&gt;Still no luck. I can confirm that I am on v. 5.1.17763.1007 of PS. Seems that v7 is not plausible (at least from the last time I tried it with PowerCLI due to .NET incompatibilities):&lt;/P&gt;&lt;P&gt;Now I'm seeing this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="curtistcreps_0-1620054200061.png" style="width: 400px;"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/88584i5D43A7AF01A1DF25/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="curtistcreps_0-1620054200061.png" alt="curtistcreps_0-1620054200061.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you recall what version of PS you used at the time of writing this article?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 15:04:09 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/PowerCLI-script-to-send-message-to-all-desktops-in-a-specific/m-p/2845198#M93866</guid>
      <dc:creator>curtistcreps</dc:creator>
      <dc:date>2021-05-03T15:04:09Z</dc:date>
    </item>
  </channel>
</rss>

