Hi experts,
I am trying to use Connect-VIServer with http. Whatever server and username/password are specified, I always get the error below.
PowerCLI C:\> Connect-VIServer -Server 101.207.40.46 -Protocol http -User foo -Password ****
Connect-VIServer : 10/19/2018 1:18:47 AM Connect-VIServer The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
At line:1 char:1
+ Connect-VIServer -Server 101.207.40.46 -Protocol http -User foo -Pass ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
My PowerCLI configuration is below,
PowerCLI C:\> Get-PowerCLIConfiguration
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Unset True 300
User Multiple
AllUsers Single Unset
I believe it's something wrong with my local settings.
Could anybody point out what the root cause is?
Thanks.
Martin
Can you connect to the Web CLient with the HTTP protocol?
Did you open the HTTP protocol on the vSphere server?
Is this to an ESXi node or a vCenter?
Is the FW on the server allowing HTTP?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
My vCenter is a "VMware vCenter Server Appliance 6.5.0.14000".
I follow this article to enable HTTP on the server.
HTTP Configuration for Web Services API Endpoint
But to tell the truth, I still believe it's something wrong with my local settings.
I run the following command with an incorrect IP address. The command still gives the same error.
PowerCLI C:\> Connect-VIServer -Server 1.1.1.1 -Protocol http -User uuuuu -Password ppppp
Connect-VIServer : 10/20/2018 11:34:08 PM Connect-VIServer The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
At line:1 char:1
+ Connect-VIServer -Server 1.1.1.1 -Protocol http -User uuuuu -Password ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
You could use Test-NetConnection to verify that the port is open.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks.
The 80 port is open, but the error is still there. Below is the whole test process, only https works.
Welcome to VMware PowerCLI!
Log in to a vCenter Server or ESX host: Connect-VIServer
To find out what commands are available, type: Get-VICommand
To show searchable help for all PowerCLI commands: Get-PowerCLIHelp
Once you've connected, display all virtual machines: Get-VM
If you need more help, visit the PowerCLI community: Get-PowerCLICommunity
Copyright (C) VMware, Inc. All rights reserved.
PowerCLI C:\> $global:DefaultVIServer
PowerCLI C:\> Test-NetConnection 10.207.40.36 -port 80 -InformationLevel "Detailed"
ComputerName : 10.207.40.36
RemoteAddress : 10.207.40.36
RemotePort : 80
AllNameResolutionResults :
MatchingIPsecRules :
NetworkIsolationContext :
InterfaceAlias : Ethernet
SourceAddress : 10.118.253.39
NetRoute (NextHop) : 10.118.252.1
PingSucceeded : True
PingReplyDetails (RTT) : 229 ms
TcpTestSucceeded : True
PowerCLI C:\> Test-NetConnection 10.207.40.36 -port 443 -InformationLevel "Detailed"
ComputerName : 10.207.40.36
RemoteAddress : 10.207.40.36
RemotePort : 443
AllNameResolutionResults :
MatchingIPsecRules :
NetworkIsolationContext :
InterfaceAlias : Ethernet
SourceAddress : 10.118.253.39
NetRoute (NextHop) : 10.118.252.1
PingSucceeded : True
PingReplyDetails (RTT) : 230 ms
TcpTestSucceeded : True
PowerCLI C:\> $global:DefaultVIServer
PowerCLI C:\> $cr=Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PowerCLI C:\> Connect-VIServer -Server 10.207.40.36 -Protocol http -Credential $cr
Connect-VIServer : 10/21/2018 9:11:14 PM Connect-VIServer The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
At line:1 char:1
+ Connect-VIServer -Server 10.207.40.36 -Protocol http -Credential $cr
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
PowerCLI C:\> $global:DefaultVIServer
PowerCLI C:\> Connect-VIServer -Server 10.207.40.36 -Protocol https -Credential $cr
Name Port User
---- ---- ----
10.207.40.36 443 VSPHERE.LOCAL\Administrator
PowerCLI C:\>
======================================================================================================
I am really confused. Why can't http work?
Did you already try setting the InvalidCertaificateAction to Ignore?
For the AllUsers scope you'll need to run this as an adminisrator.
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope AllUsers,User,Session
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your quick reply.
But the change of PowerCLI configuration still doesn't work.
I paste all the commands and output as below.
Hope they can tell someting.
==================================================================
PowerCLI C:\> Get-PowerCLIConfiguration
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Ignore True 300
User Multiple
AllUsers Single Ignore
PowerCLI C:\> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope AllUsers,User,Session
Perform operation?
Performing operation 'Update PowerCLI configuration.'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Ignore True 300
User Multiple Ignore
AllUsers Single Ignore
PowerCLI C:\> Get-PowerCLIConfiguration
Scope ProxyPolicy DefaultVIServerMode InvalidCertificateAction DisplayDeprecationWarnings WebOperationTimeout
Seconds
----- ----------- ------------------- ------------------------ -------------------------- -------------------
Session UseSystemProxy Multiple Ignore True 300
User Multiple Ignore
AllUsers Single Ignore
PowerCLI C:\> $global:DefaultVIServer
PowerCLI C:\> $cr
UserName Password
-------- --------
administrator@vsphere.local System.Security.SecureString
PowerCLI C:\> Connect-VIServer -Server 10.207.40.36 -Protocol http -Credential $cr
Connect-VIServer : 10/22/2018 1:46:24 AM Connect-VIServer The provided URI scheme 'http' is invalid; expected 'https'.
Parameter name: via
At line:1 char:1
+ Connect-VIServer -Server 10.207.40.36 -Protocol http -Credential $cr
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], ViError
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
PowerCLI C:\>
Can you connect with the Web Client over the HTTP protocol?
Or does it switch automatically to HTTPS?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It always switches automatically to HTTPS when using the Web Client.
I propose to move this thread to the vCenter community.
I suspect you might have a better chance to get an answer there.
OK with you?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference