<?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: invoke-VMScript Unable to connect to the remote server in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674481#M91768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I poked around a bit and it seems to basically work like this:&lt;/P&gt;&lt;P&gt;1. The cmdlet uses the existing PowerCLI connection to vCenter, telling it to run the command on the VM.&lt;/P&gt;&lt;P&gt;2. vCenter connects to the respective ESXi host and tells it to run the command, but does not receive the output to give back to the client.&lt;/P&gt;&lt;P&gt;3. Instead the client waits for vCenter to give him the "it's done" signal, and then the client connects to the ESXi host to grab the actual raw output being returned from the command.&lt;/P&gt;&lt;P&gt;4. PowerCLI displays that output on your console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This means your command actually has been executed, even though PowerCLI spilled the error of not being able to connect just to grab the output. I suppose that request is being done with a generic .NET web request method that use the system's proxy setting.&lt;/P&gt;&lt;P&gt;Here you can see an example of such a request from the client directly to the host (I ran the "whoami" command btw). It's really nothing but a very basic SSL'd HTTP request with a token and the response being nothing but the command's output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/62706i5705C629CCDAACD6/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this is a very odd way to handle Invoke-VMScript. It's not clear that the command has actually been executed and the host is being accessed by its IP in the HTTP host header instead of it's DNS name (with which the host is registered in vCenter and on which the SSL certificate is bound), meaning the client won't actually validate the SSL certificate presented as a browser would (and the SSL request is without SNI as well).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Nov 2015 15:50:01 GMT</pubDate>
    <dc:creator>MKguy</dc:creator>
    <dc:date>2015-11-17T15:50:01Z</dc:date>
    <item>
      <title>invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674478#M91765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two PCs, both win 7x64. PC1 has powercli 5.5 build 3142196 (5.5u2?) and the other has that and now updated to 6.0.0.7857 (latest AFAIK) via VMware-PowerCLI-6.0.0-3205540.exe from downloads section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On PC1 I can run the script&lt;/P&gt;&lt;P&gt;invoke-vmscript -ScriptText '(gwmi win32_computersystem).manufacturer -like "*vmware*"' -ToolsWaitSecs 45 -VM VMName -guestuser guestacct -guestpassword blablabla&lt;/P&gt;&lt;P&gt;and it works fine and gives me a result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I run the same command on PC1 I keep getting the error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 8pt; font-family: Lucida Console;"&gt;Invoke-VMScript : 11/16/2015 6:32:01 PM Invoke-VMScript Unable to connect to the remote server&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;at line:1 char:1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ Invoke-VMScript -ScriptText '(gwmi win32_computersystem).manufacturer -like "*vm ...&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; + CategoryInfo : NotSpecified: (:) [Invoke-VMScript], ViError&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone run into this before? I can't think of any differences in the PCs that would cause this and I'm wondering if there are any log files etc for troubleshooting I'm not aware of. The message is kinda lacking in detail. Presumably the client should log something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 23:33:53 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674478#M91765</guid>
      <dc:creator>Peteski</dc:creator>
      <dc:date>2015-11-16T23:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674479#M91766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The client where you execute the Invoke-VMScript cmdlet on actually needs to be able to connect to the physical ESXi host on port 443 where the VM is running on. Are both clients in the same subnet, do you have a firewall between hosts and clients? Just try to open the ESXi welcome webpage of the host in a browser from both clients, e.g. &lt;A href="https://citysvs0033.city.net.ffm/" title="https://citysvs0033.city.net.ffm/"&gt;https://myesxihost.local/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 12:54:09 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674479#M91766</guid>
      <dc:creator>MKguy</dc:creator>
      <dc:date>2015-11-17T12:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674480#M91767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent answer! That fixed it for me- Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It turned out that this powercli command for some reason was using the default OS user &lt;SPAN style="text-decoration: underline;"&gt;proxy settings&lt;/SPAN&gt; from the reg key: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ -&amp;gt; ProxyEnable [=1]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had wrote the script before we had a security change (and the script worked then) where certain PCs were internet restricted with the proxy enabled and pointing to a non-existent proxy server to kill internet access for security reasons. So when I ran the script now after some changes, it stopped working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is interesting is when the command fails I can connect to a vCenter server just fine with the command connect-viserver [servername], I can run all kinds of commands like update-tools on Guests etc without issue. It doesn't yet make logical sense why just invoke-vmscript doesn't work while the other commands do. The invoke-vmscript must have something in it that tries to connect to something that is the not the vCenter server and that is using the local proxy and is therefore failing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I noticed that even after changing the reg key, the command still failed until I opened IE and closed it. Not sure if coincidental but seemed to be the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 14:49:29 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674480#M91767</guid>
      <dc:creator>Peteski</dc:creator>
      <dc:date>2015-11-17T14:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674481#M91768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I poked around a bit and it seems to basically work like this:&lt;/P&gt;&lt;P&gt;1. The cmdlet uses the existing PowerCLI connection to vCenter, telling it to run the command on the VM.&lt;/P&gt;&lt;P&gt;2. vCenter connects to the respective ESXi host and tells it to run the command, but does not receive the output to give back to the client.&lt;/P&gt;&lt;P&gt;3. Instead the client waits for vCenter to give him the "it's done" signal, and then the client connects to the ESXi host to grab the actual raw output being returned from the command.&lt;/P&gt;&lt;P&gt;4. PowerCLI displays that output on your console.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This means your command actually has been executed, even though PowerCLI spilled the error of not being able to connect just to grab the output. I suppose that request is being done with a generic .NET web request method that use the system's proxy setting.&lt;/P&gt;&lt;P&gt;Here you can see an example of such a request from the client directly to the host (I ran the "whoami" command btw). It's really nothing but a very basic SSL'd HTTP request with a token and the response being nothing but the command's output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://communities.vmware.com/t5/image/serverpage/image-id/62706i5705C629CCDAACD6/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this is a very odd way to handle Invoke-VMScript. It's not clear that the command has actually been executed and the host is being accessed by its IP in the HTTP host header instead of it's DNS name (with which the host is registered in vCenter and on which the SSL certificate is bound), meaning the client won't actually validate the SSL certificate presented as a browser would (and the SSL request is without SNI as well).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 15:50:01 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674481#M91768</guid>
      <dc:creator>MKguy</dc:creator>
      <dc:date>2015-11-17T15:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674482#M91769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Old thread problem still exists&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My target VM is Windows Server 2012R2 - thus PowerShell or BAT scripts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MKGuy wrote...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #2873ee; font-family: proxima-nova, Arial, sans-serif;"&gt; the host is being accessed by its IP in the HTTP host header instead of it's DNS name (with which the host is registered in vCenter and on which the SSL certificate is bound), meaning the client won't actually validate the SSL certificate presented as a browser would (and the SSL request is without SNI as well).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This explains why Invoke-VMScript does not work my NAT'd environments.&lt;/P&gt;&lt;P&gt;Scripts are being executed on the VM but the Invoke-VMScript returns an error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3334ca;"&gt;VERBOSE: 10/19/2017 11:04:38 AM Invoke-VMScript Started execution&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3334ca;"&gt;VERBOSE: Performing the operation "Invoke-VMScript" on target "xyz"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3334ca;"&gt;VERBOSE: 10/19/2017 11:04:38 AM Invoke-VMScript Finished execution&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3334ca;"&gt;FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My development offices access our vCenter data center via VPN . &lt;/P&gt;&lt;P&gt;To prevent address conflicts between our office, traffic between our development offices and data centers is NAT'd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The native vCenter data center DNS is vcenter1.mydomain.com 10.11.100.7&lt;/P&gt;&lt;P&gt;The NAT'd development DNS entry is vcenter1.mydomain.com 10.15.100.7&lt;/P&gt;&lt;P&gt;The ESX hosts addresses follow the same pattern host1.mydomain.com 10.15.10.153 vs 10.11.10.153&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far, everything in PowerCLI works fine other than Invoke-VMScript.&lt;/P&gt;&lt;P&gt;Using &lt;SPAN style="color: #555555; font-family: proxima-nova, Verdana, Tahoma, Arial, sans-serif; font-size: 12px;"&gt;&lt;STRONG&gt;RunAsync &lt;/STRONG&gt;&lt;/SPAN&gt;as a work around might be an option, but I need the results of the script output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can Invoke-VMScript be changed to reconnect to the host using the host DNS name instead of IP ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is there a configuration option I missed to return host DNS vs host IP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My environment :&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;VCenter 6.5&lt;/P&gt;&lt;P&gt;VMware ESXi, 6.5.0, 5969303&lt;/P&gt;&lt;P&gt;PowerCLI 6.5.3 as of yesterday ( also tried 6.5.1 and 2)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 18:51:49 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674482#M91769</guid>
      <dc:creator>KevinFoley</dc:creator>
      <dc:date>2017-10-19T18:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674483#M91770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you already try with my &lt;A href="http://www.lucd.info/2017/09/14/invoke-vmscriptplus/"&gt;Invoke-VMScriptPlus&lt;/A&gt; function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 18:57:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674483#M91770</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2017-10-19T18:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674484#M91771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello LucD,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I failed to mention my target VM is Windows Server 2012R2.&lt;/P&gt;&lt;P&gt;I reviewed your Invoke-VMScriptPlus and it appears to be Linux specific&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 19:49:16 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674484#M91771</guid>
      <dc:creator>KevinFoley</dc:creator>
      <dc:date>2017-10-19T19:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: invoke-VMScript Unable to connect to the remote server</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674485#M91772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it is I'm afraid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this gave me an idea to expand my function towards Win guest OS as well.&lt;/P&gt;&lt;P&gt;I'll be looking into that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 19:55:55 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/invoke-VMScript-Unable-to-connect-to-the-remote-server/m-p/2674485#M91772</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2017-10-19T19:55:55Z</dc:date>
    </item>
  </channel>
</rss>

