sna696
Contributor
Contributor

PowerCLI issue on CentOS 7 Linux

Hi everyone,

I wrote a simple script that gathers informations from vCenter servers and I'm trying to making a port to Linux.

I'm using CentOS 7, got PowerShell 6.1 Core installed and PowerCLI 11 directly from the online repository.

When I try to connect to the vCenter server version 6.7 I get this error:

Connect-VIServer : No such device or address

The same thing happens with version 6.5.

I get no problems at all if I connect directly to hypervisors.

Do anyone had such kind of issue with PowerCLI on Linux?

Many thanks in advance!

0 Kudos
12 Replies
mkmr
Contributor
Contributor

Even I have this similar issue with CentOS & Ubuntu. Any help would be appreciated.. Thanks

0 Kudos
daphnissov
Immortal
Immortal

CentOS 7, PowerShell Core 6.1.1, PowerCLI 11. No problems here.

0 Kudos
mkmr
Contributor
Contributor

Thanks for the response daphnissov

I have followed below steps and please let me know if i missed out anything.

1. Downloaded this rpm ` powershell-6.1.1-1.rhel.7.x86_64.rpm` from here Release v6.1.1 Release of PowerShell Core · PowerShell/PowerShell · GitHub

2. On the CentOS host machine installed this rpm using `rpm -ivh powershell-6.1.1-1.rhel.7.x86_64.rpm` along with `yum install libicu` as powershell depends on this package.

3.Installed PowerShell version is 6.1.1

```

[root@m**-vm1 tmp]# pwsh

PowerShell 6.1.1

Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs

Type 'help' to get help.

PS /tmp>

```

4.  Then installed `VMware.PowerCLI ` module using this command `Install-Module -Name VMware.PowerCLI`. The version details shown below.

11.1.0.11289667  VMware.PowerCLI                 PSGallery        This Windows PowerShell module contains VMware.PowerCLI

5. suppressed the certification error using this command `Set-PowerCLIConfiguration -InvalidCertificateAction ignore`

6. Tried to connect the vSphere using `Connect-VIServer -Server 10.xx.xxx.xx -User mu****@vsphere.local -Password W*****! `  then i noticed the below error.

Connect-VIServer : No such device or address

At line:1 char:1

+ Connect-VIServer -Server 10.xx.xxx.xx -User mu****@vsphere.local -P ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

+ FullyQualifiedErrorId : System.ServiceModel.CommunicationException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

I am able to connect with same vSphere via powershell on my mac without any issue but i get the above error from CentOS.

0 Kudos
mkmr
Contributor
Contributor

Tried with VMware.PowerCLI version 11.0.0.10380590 and the error remains same...

Install-Module -Name VMware.PowerCLI -RequiredVersion 11.0.0.10380590

0 Kudos
daphnissov
Immortal
Immortal

Please always use FQDNs when addressing vSphere resources, not IP addresses. What is this version of vCenter? You can ping it from this CentOS box, yes? Can you do a successful curl to it?

0 Kudos
mkmr
Contributor
Contributor

Thanks daphnissov

1. What is this version of vCenter  - 6.5.0.13000

2. You can ping it from this CentOS box - Yes

3. Can you do a successful curl to it - Yes..curl -k https://10.xx.xxx.xxx, Also i can able to do the telnet & nc on this host with port 80 & 443.  As i mentioned earlier, I am able to build the connection with vCenter using IP address from Mac but not from CentOS. I think i am missing some settings / steps related to Linux that causes this issue????

curl -v telnet://10.xx.xxx.xx:443

* About to connect() to 10.xx.xxx.xx port 443 (#0)

*   Trying 10.xx.xxx.xx...

* Connected to 10.xx.xxx.xx (10.xx.xxx.xx) port 443 (#0)

telnet 10.xx.xxx.xx 443

Trying 10.xx.xxx.xx...

Connected to 10.xx.xxx.xx

Escape character is '^]'.

curl -k https://10.xx.xxx.xxx

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <script type="text/javascript" src="./en/welcomeRes.js"> </script>

  <script type="text/javascript" src="./scripts/setUserLocale.js"> </script>

  <script type="text/javascript">document.write("<title>" + ID_VC_Welcome + "</title>");</script>

  <link rel="stylesheet" href="./default.css" type="text/css" />

  <link rel="stylesheet" href="./print.css" type="text/css" media="print" />

  <meta name="description" content="VMware vSphere is virtual infrastructure software for partitioning, consolidating and managing systems in mission-critical environments. VMware ESX Server provides a highly scalable platform with advanced resource management capabilities, which can be managed by vSphere."/>

</head>

<body>

  <div id="header"><img src="./header-logo.png" width="586" height="42" alt="VMware vSphere 6" /></div>

  <div class="gettingStarted">

   <h1><script type="text/javascript">document.write(ID_GettingStarted);</script></h1>

   <p><script type="text/javascript">document.write(ID_VC_GettingStartedDesc);</script></p>

   <p><a href="https://communities.vmware.com/vsphere-client/"><script type="text/javascript">document.write(ID_LogInFlexClient);</script></a></p>

   <p><a href="https://communities.vmware.com/ui/"><script type="text/javascript">document.write(ID_LogInH5Client);</script></a></p>

   <p><script type="text/javascript">document.write(ID_DocDesc);</script></p>

   <p><a href="http://www.vmware.com/info?id=1414"><script type="text/javascript">document.write(ID_DownloadDoc);</script></a></p>

   <p><a href="http://pubs.vmware.com/Release_Notes/en/vsphere/65/vsphere-client-65-html5-functionality-support.htm...">

      <script type="text/javascript">document.write(ID_H5ClientDoc);</script></a></p>

  </div> <!--/GETTING STARTED TEXT-->

  <div class="GSimage"></div>

  <div class="forAdmins">

   <h1><script type="text/javascript">document.write(ID_ForAdmins);</script></h1>

   <h1><script type="text/javascript">document.write(ID_VIDatacenters);</script></h1>

   <p><script type="text/javascript">document.write(ID_VIDatacentersDesc);</script></p>

   <p><script type="text/javascript">document.write('<a href="https://communities.vmware.com/folder">'+ ID_BrowseVCDatacenters +'</a>');</script></p>

   <h1><script type="text/javascript">document.write(ID_ForDevs);</script></h1>

   <h1><script type="text/javascript">document.write(ID_VISDK);</script></h1>

   <p><script type="text/javascript">document.write(ID_VISDKDesc);</script></p>

   <p><script type="text/javascript">document.write('<a href="http://www.vmware.com/info?id=928">'+ ID_DownloadSDK +'</a>');</script></p>

   <p><script type="text/javascript">document.write('<a href="https://communities.vmware.com/mob/">'+ ID_BrowseVC +'</a>');</script></p>

   <p><script type="text/javascript">document.write('<a href="https://communities.vmware.com/apiexplorer/">'+ ID_ApiExplorer +'</a>');</script></p>

   <p><script type="text/javascript">document.write('<a href="https://communities.vmware.com/certs/download.zip">'+ ID_DownloadCerts +'</a>');</script></p>

  </div>

  <div id="copyRight">

   <script type="text/javascript">document.write(ID_CopyrightText);</script>

   <script type="text/javascript">document.write(ID_TrademarkText);</script>

   <script type="text/javascript">document.write(ID_AboutOSSDesc);</script>

  </div>

 

</body>

</html>

0 Kudos
daphnissov
Immortal
Immortal

0 Kudos
LucD
Leadership
Leadership

Could this be a TLS version mismatch issue?


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

0 Kudos
mkmr
Contributor
Contributor

this turned out to NSX re-director issue and when i mad the entry into host file that fixed that issue..sna696 Can you also please check this is the case with you also.

Thanks to daphnissovLucD

0 Kudos
sna696
Contributor
Contributor

Thanks guys for your support.

I am unable to access the environment for a while, due to time restrictions I was forced to run it on a Windows machine.

LucD previously I was able to access the vCenter with the Windows PowerShell, it would be weird on Linux since I've set to ignore certificate validation too.

mkmr​ I'm using vCenter FQDNs, never had such kind of issue

0 Kudos
LucD
Leadership
Leadership

It would be interesting to check if you encounter the same issue when running this from Windows, but also under PowerShell v6.

And yes, you can run those side-by-side on a Windows box.


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

0 Kudos
klabiak
Enthusiast
Enthusiast

I have had a very similar issue.

My solution was to disable proxy server configured on the Linux system.

I am using opensuse 15, and pwsh + VMware.PowerCLI works fine. 

0 Kudos