<?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: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection in Horizon Desktops and Apps</title>
    <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416602#M82268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interested parties,&lt;/P&gt;&lt;P&gt;It took a bit of browsing git hub....but I think&lt;/P&gt;&lt;P&gt;I just found code on github that may have the snippet I need.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/cjrege/HorizonView" title="https://github.com/cjrege/HorizonView"&gt;GitHub - cjrege/HorizonView: VMware Horizon View PowerShell Module&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically see &lt;SPAN class="pl-k" style="color: #d73a49; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;Invoke-ViewComposerTask&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;And in that function:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="js-file-line-container highlight tab-size" data-tab-size="8" style="color: #24292e; font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;Refresh&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2100" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;New-Object&lt;/SPAN&gt; VMware.Hv.DesktopRefreshSpec&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2101" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;New-Object&lt;/SPAN&gt; VMware.Hv.DesktopService&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;+&lt;/SPAN&gt;DesktopRefreshSpecHelper&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2102" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2103" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;switch&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;LogOffSetting&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2104" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"WAIT_FOR_LOGOFF"&lt;/SPAN&gt; {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2105" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LogoffSetting&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LOGOFF_SETTING_WAIT_FOR_LOGOFF&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2106" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2107" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"FORCE_LOGOFF"&lt;/SPAN&gt; {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2108" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LogoffSetting&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LOGOFF_SETTING_FORCE_LOGOFF&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2109" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2110" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; default {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2111" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;throw&lt;/SPAN&gt; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"Logoff setting not permitted"&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2112" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2113" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2114" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2115" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartTime&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2116" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StartTime&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartTime&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2117" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2118" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartNow&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2119" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StartTime&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;Get-Date&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;.AddMinutes&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2120" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2121" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Machines&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;machines&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Id&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2122" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StopOnFirstError&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StopOnFirstError&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2123" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-c" style="color: #6a737d;"&gt;# Execute refresh&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2124" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;Write-Host&lt;/SPAN&gt; Refreshing &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopPool&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Base.Name&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;-&lt;/SPAN&gt;ForegroundColor Cyan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2125" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopService&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Desktop_Refresh&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;HvServices&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopPoolId&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2126" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Don't know why this was pasted into a table...but here you can see the code above that should refresh the desktop using machine id&lt;/P&gt;&lt;P&gt;Written by user cjrege. I am going to try now. Thanks to all and will post when I solve this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Feb 2018 20:05:32 GMT</pubDate>
    <dc:creator>pegduffy</dc:creator>
    <dc:date>2018-02-06T20:05:32Z</dc:date>
    <item>
      <title>Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416597#M82263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1 style="margin-bottom: 18px; font-size: 30px; font-family: proxima-nova, Arial, sans-serif; color: #4d4e53;"&gt;&lt;SPAN style="font-size: 12pt;"&gt;I read this article&lt;/SPAN&gt;.&lt;/H1&gt;&lt;H1 style="margin-bottom: 18px; font-size: 30px; font-family: proxima-nova, Arial, sans-serif; color: #4d4e53;"&gt; &lt;A _jive_internal="true" href="https://communities.vmware.com/message/2712964#2712964" name="&amp;amp;amp;lpos=apps_scodevmw : 77" style="font-weight: inherit; font-style: inherit; font-size: inherit; font-family: inherit; color: #3399cc;"&gt;Reset/Refresh Horizon Desktop in a Problem State using PowerShell&lt;BR /&gt;&lt;/A&gt;&lt;/H1&gt;&lt;P&gt;I read the answer here : &lt;A href="https://github.com/Magneet/Various_Scripts/blob/master/remove_faulty_VDI_desktop.ps1" title="https://github.com/Magneet/Various_Scripts/blob/master/remove_faulty_VDI_desktop.ps1"&gt;Various_Scripts/remove_faulty_VDI_desktop.ps1 at master · Magneet/Various_Scripts · GitHub&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way, &lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;not&lt;/STRONG&gt; &lt;/SPAN&gt;to remove of delete the Agent_Unreachable machine but to just try a &lt;STRONG&gt;desktop refresh&lt;/STRONG&gt; or the equivalent, &lt;SPAN style="color: #e23d39;"&gt;without&lt;/SPAN&gt; doing a Connect-VIServer, but using only&amp;nbsp; the HV server connection?&lt;/P&gt;&lt;P&gt;I have tried many of the API commands of this nature but can not seem to find a way to do this without a VIServer connection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;Is it possible? Has anyone done it? Would you be willing to share a snippet of your code to guide me.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to get-hvsummary for each Pool, using -State Unreachable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, my VMware sysadmins believe this is possible and I am tryng to write the code. I have looked at many calls in the API but get message like "You need a connection to VI Server."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script&amp;nbsp; making a list of machines in an unreachable state...and then 15 minutes later, by writing results to files and reading previous file back in again....if machine is still unreachable 15 minutes later I want to do whatever is equivalent to a Desktop_Refresh. I have machineids etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peg Duffy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 17:48:23 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416597#M82263</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-02T17:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416598#M82264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are your VMWare admins not writing this script? Anyway. I had a few minutes and thought this would be be helpful to you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'l need this &lt;A href="https://github.com/vmware/PowerCLI-Example-Scripts/tree/master/Modules/VMware.Hv.Helper" title="https://github.com/vmware/PowerCLI-Example-Scripts/tree/master/Modules/VMware.Hv.Helper"&gt;PowerCLI-Example-Scripts/Modules/VMware.Hv.Helper at master · vmware/PowerCLI-Example-Scripts · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives you the full arsenal of the Horizon API and the &lt;SPAN style="color: #303030; font-size: 10pt; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;&lt;STRONG&gt;vmware.view.broker &lt;/STRONG&gt;&lt;/SPAN&gt;snapin from the Horizon server in case you want to do other things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also replace, from line 31, the Send-VDIVMReset with Send-VDILinkedCloneRefresh for example if you needed to do a refresh instead of a reset and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're welcome &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.vmware.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1517599833325140 jive_text_macro" data-renderedposition="240_8_1232_560" jivemacro_uid="_1517599833325140"&gt;&lt;P&gt;#Jose Rodriguez&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$viewserver = "NAME_OF_VIEW_SERVER" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if($cred -eq $null){&lt;/P&gt;&lt;P&gt;$cred = Get-Credential&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if($connect -eq $null){&lt;/P&gt;&lt;P&gt;$connect = Connect-HVServer -server $viewserver -Credential $cred&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$session = New-PSSession -Computername $viewserver &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$scriptBlock = { &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-PSSnapin vmware.view.broker &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;#Run the script block on the connection server.&amp;nbsp; $argument1 will become $computer in the scriptblock and so forth &lt;/P&gt;&lt;P&gt;Invoke-Command -Session $session -ScriptBlock $scriptBlock&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Import-PSSession -Session $session -Prefix VDI -Module VMware*&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Get-HVMachine -PoolName NAME_OF_POOL).base | where {$_.basicstate -eq 'AGENT_UNREACHABLE'} | foreach { Get-VDIDesktopVM -Name $_.name | Send-VDIVMReset -id $_.id }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remove-PSSession $session&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'times new roman', times;"&gt;&lt;EM&gt;~I'm just an IT enthusiast with no certs, no degrees, no training, in any of this crap, but I know my around google so that's all that matters. -Jose Rodriguez~&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 19:31:36 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416598#M82264</guid>
      <dc:creator>jrodsguitar</dc:creator>
      <dc:date>2018-02-02T19:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416599#M82265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can be done certainly, have written it out on my blog: &lt;A href="https://www.retouw.nl/powercli/removing-faulty-horizon-desktops-using-powercli/" title="https://www.retouw.nl/powercli/removing-faulty-horizon-desktops-using-powercli/"&gt;https://www.retouw.nl/powercli/removing-faulty-horizon-desktops-using-powercli/&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I see I might need to change it so it doesn't use the vmware.hv.helper (needs lots of improvements, working on that) and you can choose to remove or reset, just comment the right line out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 08:28:30 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416599#M82265</guid>
      <dc:creator>Magneet</dc:creator>
      <dc:date>2018-02-05T08:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416600#M82266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your answer. I am sorry I steered you wrong. I am using Horizon 7 Version 7.2 so I can not use snap-ins. The commandlets you are using are no longer available.&lt;/P&gt;&lt;P&gt;No Send-VDILinkedCloneRefresh in this version. Just the &lt;A href="https://code.vmware.com/apis/75/view" title="https://code.vmware.com/apis/75/view"&gt;View API - VMware API Explorer - VMware {code}&lt;/A&gt;&lt;/P&gt;&lt;H1 style="margin-top: 5px; margin-bottom: 10px; font-family: proxima-nova, Verdana, Tahoma, Arial, sans-serif; font-weight: 300; color: #0095d3; font-size: 40px; padding-top: 5px; padding-bottom: 5px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;View API 7.1.0, Agent version 7.2.0&lt;/SPAN&gt;&lt;/H1&gt;&lt;P&gt;I would like to do what is on the View Horizon Admin Center Version 7 as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Catalog -&amp;gt; Desktop Pools -&amp;gt; Select one of the Pools....-&amp;gt; Look at Inventory of Machines -&amp;gt; Select one -&amp;gt; View Composer -&amp;gt; Refresh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the previous Send-VDILinkedCloneRefresh is probably what I needed prior to this version.&lt;/P&gt;&lt;P&gt;I am using VMWare.Hv.Helper....but no equivalent commandlets there that I can tell.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 18:02:53 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416600#M82266</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-06T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416601#M82267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Magneet,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not want to delete the machine. I want to Refresh it only.&lt;/P&gt;&lt;P&gt;Is it possible to do this using only a connection to an HVserver....Connect-HVServer but &lt;STRONG&gt;not&lt;/STRONG&gt; using a Connect-VIServer?&lt;/P&gt;&lt;P&gt;I did see your code and you solution. Perhaps what I am attempting is not possible.&lt;/P&gt;&lt;P&gt;Do you know?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 18:05:56 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416601#M82267</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-06T18:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416602#M82268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interested parties,&lt;/P&gt;&lt;P&gt;It took a bit of browsing git hub....but I think&lt;/P&gt;&lt;P&gt;I just found code on github that may have the snippet I need.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/cjrege/HorizonView" title="https://github.com/cjrege/HorizonView"&gt;GitHub - cjrege/HorizonView: VMware Horizon View PowerShell Module&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically see &lt;SPAN class="pl-k" style="color: #d73a49; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="color: #24292e; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;Invoke-ViewComposerTask&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;And in that function:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pl-en" style="color: #6f42c1; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="js-file-line-container highlight tab-size" data-tab-size="8" style="color: #24292e; font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;Refresh&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2100" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;New-Object&lt;/SPAN&gt; VMware.Hv.DesktopRefreshSpec&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2101" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;New-Object&lt;/SPAN&gt; VMware.Hv.DesktopService&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;+&lt;/SPAN&gt;DesktopRefreshSpecHelper&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2102" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2103" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;switch&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;LogOffSetting&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2104" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"WAIT_FOR_LOGOFF"&lt;/SPAN&gt; {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2105" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LogoffSetting&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LOGOFF_SETTING_WAIT_FOR_LOGOFF&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2106" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2107" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"FORCE_LOGOFF"&lt;/SPAN&gt; {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2108" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LogoffSetting&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpecHelper&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.LOGOFF_SETTING_FORCE_LOGOFF&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2109" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2110" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; default {&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2111" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;throw&lt;/SPAN&gt; &lt;SPAN class="pl-s" style="color: #032f62;"&gt;"Logoff setting not permitted"&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2112" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2113" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2114" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2115" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartTime&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2116" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StartTime&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartTime&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2117" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2118" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StartNow&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;{&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2119" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StartTime&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;Get-Date&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;.AddMinutes&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2120" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2121" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Machines&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;machines&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Id&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2122" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.StopOnFirstError&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;StopOnFirstError&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2123" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-c" style="color: #6a737d;"&gt;# Execute refresh&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2124" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-c1" style="color: #005cc5;"&gt;Write-Host&lt;/SPAN&gt; Refreshing &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopPool&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Base.Name&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;-&lt;/SPAN&gt;ForegroundColor Cyan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2125" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopService&lt;/SPAN&gt;&lt;SPAN class="pl-en" style="color: #6f42c1;"&gt;.Desktop_Refresh&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;HvServices&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;desktopPoolId&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pl-k" style="color: #d73a49;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="pl-smi"&gt;refreshSpec&lt;/SPAN&gt;&lt;SPAN class="pl-k" style="color: #d73a49;"&gt;)&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="blob-num js-line-number" data-line-number="2126" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; color: rgba(27, 31, 35, 0.3); text-align: right;"&gt;&lt;/TD&gt;&lt;TD class="blob-code blob-code-inner js-file-line" style="padding: 0 10px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&amp;nbsp; }&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Don't know why this was pasted into a table...but here you can see the code above that should refresh the desktop using machine id&lt;/P&gt;&lt;P&gt;Written by user cjrege. I am going to try now. Thanks to all and will post when I solve this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 20:05:32 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416602#M82268</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-06T20:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416603#M82269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;*Updated the script slightly.*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://get-cj.com/2018/04/02/how-to-refresh-vmware-horizon-desktops-using-powershell-powercli/"&gt;https://get-cj.com/2018/04/02/how-to-refresh-vmware-horizon-desktops-using-powershell-powercli/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was inspired by &lt;B&gt;pegduffy&lt;/B&gt;​ after you posted that snippet of code. I wrote a new function that refreshes a desktop or a list of desktops. Much of the reference for this comes from the various VMWare sites and Horizon API reference pages. Please post your solution as well when you find it. If you want &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp; It's good to see the way others do it. Good learning experience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$machines = ('machinename1', 'machinename2')&lt;/P&gt;&lt;P&gt;refresh-ViewDesktop -machines $machines -viewserver&amp;nbsp; 'Horizon_Connection_Server'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="text-align: Left; font-family: Segoe UI; font-style: normal; font-weight: normal; font-size: 12; color: #000000;"&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 16;"&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;refresh-ViewDesktop&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00bfff;"&gt;&lt;SPAN&gt;CmdletBinding&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00bfff;"&gt;&lt;SPAN&gt;OutputType&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;SPAN&gt;PSCustomObject&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;param&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[]]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machines&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;SPAN&gt;string&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$viewserver&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$cred&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;Get-Credential&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$hvServer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;Connect-HVServer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-server&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$viewserver&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-Credential&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$cred&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$hvServices&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$hvServer&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;ExtensionData&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$queryService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.QueryServiceService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$query&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.QueryDefinition&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$query&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;queryEntityType &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;'MachineNamesView'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;SPAN&gt;VMware.Hv.QueryFilter&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[]]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$filters&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; @()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machines&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;){&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$filters&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;+=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;new-object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.QueryFilterEquals&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-property&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; @{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;'memberName'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;'base.name'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;'value'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$orFilter&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;new-object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.QueryFilterOr&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-property&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; @{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;'filters'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$filters&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$query&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Filter &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$orFilter&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$queryResults&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$queryService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;QueryService_Create(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$hvServices&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$query&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$finalmachine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; @()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$queryResults&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Results){&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080;"&gt;&lt;SPAN&gt;VMware.Hv.MachineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$properties&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; @{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; machineid &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;id&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; names &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;base&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desktopId &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;base&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Desktop&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$finalmachine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;+=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-TypeName&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;pscustomobject&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080;"&gt;&lt;SPAN&gt;-Property&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$properties&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktopService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.DesktopService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.MachineService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #00008b;"&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$finalmachine&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;){&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.DesktopRefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefresheSpecHelper&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;New-Object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8a2be2;"&gt;&lt;SPAN&gt;VMware.Hv.DesktopService+DesktopRefreshSpecHelper&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Machines &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;machineid&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;LogoffSetting &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefresheSpecHelper&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;LOGOFF_SETTING_FORCE_LOGOFF&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;StartTime &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$null&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktopService&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Desktop_Refresh(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$hvServices&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$machineNamesView&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;base&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Desktop&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$desktoprefreshSpec&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;Write-Output&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;""&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN&gt;Write-Output&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #8b0000;"&gt;&lt;SPAN&gt;"Refreshing Machines"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #ff4500;"&gt;&lt;SPAN&gt;$object&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #a9a9a9;"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;names)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: Lucida Console; margin: 0 0 0 0; background-color: #ffffff;"&gt;&lt;SPAN&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'times new roman', times; color: #666666;"&gt;&lt;EM&gt;Disclaimer: ~I'm just an IT enthusiast with no certs, no degrees, no training, in any of this crap, but I know my way around google so that's all that matters. -Jose Rodriguez~&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 02:29:38 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416603#M82269</guid>
      <dc:creator>jrodsguitar</dc:creator>
      <dc:date>2018-02-07T02:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416604#M82270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree on jrodsguitar's solution but it's stupid that the spec is required that only makes it more complicated &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 21:08:52 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416604#M82270</guid>
      <dc:creator>Magneet</dc:creator>
      <dc:date>2018-02-07T21:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416605#M82271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The solution posted will work. Here is my solution. (different and not yet refactored so forgive)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2018 17:24:05 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416605#M82271</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-09T17:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416606#M82272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;B&gt;pegduffy&lt;/B&gt;​ &amp;amp; &lt;B&gt;jrodsguitar&lt;/B&gt;​ you guys want to put this in the vmware.hv.helper module? Could do it as well myself for you based on your work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Feb 2018 11:50:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416606#M82272</guid>
      <dc:creator>Magneet</dc:creator>
      <dc:date>2018-02-10T11:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416607#M82273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;Magneet,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;Please feel free to use any of my code. And thank you for the hv.helper module. I suspect you tcan integrate the code better than I into that module. I have used the module in my code as you see and thank you again for that.&lt;/P&gt;&lt;P style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;I am now testing my code in a test environment by putting test machines in unreachable_agent state - basically logging into a specific desktop and killing of the Agent service, -&amp;nbsp; and then refreshing them (my test environment is isolated into a single pool specific test pool). I have tested a bit before posting so the code works for me. Please enjoy. Nice to be able to "pay it forward".&lt;/P&gt;&lt;P style="color: #000000; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;"&gt;&lt;BR /&gt;Thanks to you, cjrege, and&amp;nbsp; &lt;A _jive_internal="true" class="x_x_jive-link-profile-small x_x_jiveTT-hover-user" href="https://communities.vmware.com/people/jrodsguitar" rel="noopener noreferrer" target="_blank"&gt;jrodsguitar&lt;/A&gt;!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2018 18:27:35 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416607#M82273</guid>
      <dc:creator>pegduffy</dc:creator>
      <dc:date>2018-02-12T18:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416608#M82274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that would be cool. I've learned so much from the community so giving back is not a problem &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2018 18:29:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416608#M82274</guid>
      <dc:creator>jrodsguitar</dc:creator>
      <dc:date>2018-02-12T18:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to programmtically, using 6.5.1 PS and API 7.1, to Reset/Refresh Horizon Desktop in a Problem State using PowerShell using only an HVServer connection</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416609#M82275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure when but I will definitely try to get this into the module, I am also just a contributor to it by the way. Untill now I only fixed or found a few bugs but have a couple of new functions &amp;amp; fixes waiting for a commit &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Feb 2018 20:56:26 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Is-it-possible-to-programmtically-using-6-5-1-PS-and-API-7-1-to/m-p/1416609#M82275</guid>
      <dc:creator>Magneet</dc:creator>
      <dc:date>2018-02-12T20:56:26Z</dc:date>
    </item>
  </channel>
</rss>

