VMware Cloud Community
SJM74
Contributor
Contributor

Connect-VIServer: The underlying connection was closed: An unexpected error occurred on a send.

Good day fine folks,


I am developing a simple remove-vm that is being initiated by a Web Service. I can run the script from my Windows desktop with no errors. On a W2003 SP2 server, Connect-VIServer fails with the error below both from the PowerCLI and when the script is loaded via the Web Service. All of this worked prior to moving to ESX 5.5.

Command Run: Connect-VIServer $vcserver -User $user -Password $password -EA 'Stop'

Connect-VIServer : 08/10/2014 14:12:32    Connect-VIServer        The underlying connection was closed: An unexpected e

rror occurred on a send.

At line:1 char:17

+ Connect-VIServer <<<<  VCSERVERFQDN -user USER -password PASS

    + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], ViError

    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_WebException,VMware.VimAutomation.ViCore.Cmdl

   ets.Commands.ConnectVIServer

Troubleshooting

  • Logged into VC to ensure access
  • Telnet from Server to VCServer:443 successfully
  • Set the ProxyPolicy to NoProxy
  • Set the InvalidCertificateAction to Ignore
  • Increased Timeouts to 300 seconds (it usually fails in about 5)

Attached are the version of Powershell, PowerCLI and .NET on each host.

Any help is greatly appreciated.

0 Kudos
2 Replies
LucD
Leadership
Leadership

Is that a Windows 2003 or a Windows 2003 R2 ?

Afaik, PowerCLI 5.1 is not supported on Windows 2003, but it is on Windows 2003 R2.

See the Release Notes

Does restarting the Web Services on the vCenter change anything ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

SJM74
Contributor
Contributor

LucD,

Thanks for responding. It's W2003 Enterprise SP 2. Not R2. That may be the issue.

This may be part of it as well. I'll try to get the appropriate team to try these steps. From the release notes Known issues:

Connect-VIServer

Connect-VIServer cannot use the Kerberos network authentication protocol to connect to vCenter Server systems that are installed under a custom user account on a Windows system. Connect-VIServer uses NTLM instead.

Workaround: Install and run vCenter Server under the default system account. Alternatively, you can:

  1. Add another IP to the Windows system where vCenter Server is running.
  2. Register a new A DNS record for the IP.
  3. Run the setspn tool to register an SPN for the new DNS record and associate it with the vCenter Server account under which vCenter Server was installed.

    For example: To register an SPN for the vc-alias.domain.com DNS and the VCAccount account, run:
    setspn -A -HOST/vc-alias.domain.com Domain\VCAccount
  4. Use the new DNS name to connect to the vCenter Server system.
    For example: Run Connect-VIServer vc-alias.domain.com
0 Kudos