Change vSphere PowerCLI proxy settings

January 24, 2011 — 4 Comments

Today I was performing a test in the vSphere cluster I have in my laptop and when I tried to connect to the vCenter Server with PowerCLI I got the following error.

C:\Users\juanma
[vSphere PowerCLI] % get-vc vcenter.mlab.local -user Administrator -Password vmwarerules!
Connect-VIServer : 24/01/2011 12:58:33    Connect-VIServer        Could not connect using the requested protocol.   
At line:1 char:7
+ get-vc <<<<  vcenter.mlab.local -user Administrator -Password J3d1kn1gh/
 + CategoryInfo          : ObjectNotFound: (:) [Connect-VIServer], ViServerConnectionException
 + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_ProtocolError,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

C:\Users\juanma
[vSphere PowerCLI] %

My first thought after that was to check network connectivity and the firewall configuration of the vCenter Server but everything was OK. Then after a quick search in the VMware Communities I found the solution in this post.

The problem was the proxy server configuration of PowerCLI, I’m used to do everything directly from the vCenter desktop, where I have installed PowerCLI and the vSphere Client, but this time I tried to connect directly from my laptop and since I was connected to the corporate network PowerCLI was trying to connect through the proxy server. Following is how I fixed this thanks to the above VMTN post.

First retrieve the PowerCLI proxy configuration with the Get-PowerCLIConfiguration cmdlet.

C:\Users\juanma
[vSphere PowerCLI] % Get-PowerCLIConfiguration

Proxy Policy    Default Server
                Mode          
------------    ---------------
UseSystemProxy  Multiple       

C:\Users\juanma
[vSphere PowerCLI] %

As you can see Proxy Policy is set to UseSystemProxy. To set this value to NoProxy use the cmdlet Set-PowerCLIConfiguration.

C:\Users\juanma
[vSphere PowerCLI] % Set-PowerCLIConfiguration -ProxyPolicy NoProxy

Perform operation?
Performing operation 'Update vSphere PowerCLI configuration.'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y

Proxy Policy    Default Server
                Mode          
------------    ---------------
NoProxy         Multiple       

C:\Users\juanma
[vSphere PowerCLI] %

Now try to reconnect to the vCenter Server and everything should go without errors.

C:\Users\juanma
[vSphere PowerCLI] % get-vc vcenter.mlab.local -user Administrator -Password vmwarerules!
WARNING: There were one or more problems with the server certificate:

* The X509 chain could not be built up to the root certificate.

* The certificate's CN name does not match the passed value.

Name                                           Port                                        User                                        
----                                           ----                                        ----                                        
vcenter.mlab.local                             443                                         Administrator                                

C:\Users\juanma
[vSphere PowerCLI] %

Juanma.

Advertisements

4 responses to Change vSphere PowerCLI proxy settings

  1. 

    You saved me life!!!!!!!!! Thanks :)

  2. 

    This is really attention-grabbing, You’re an overly skilled blogger. I have joined your feed and look forward to in quest of extra of your excellent post. Also, I have shared your website in my social networks

  3. 

    Pretty! This was an extremely wonderful article. Many thanks for supplying this information.

  4. 

    Xllent…. I have worried so much about the error. Awesome

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s