Enthusiast
Enthusiast

powercli 10 connect-viserver error method not found

Hello,

I am having a bit of a challenge getting PowerCLI 10 to connect to my vCenter server (VCSA 6.0 U3). When I run the Connect-VIServer command I get the following error:

Connect-VIServer : Method not found: 'Void VMware.Binding.Sts.VmwareSecruityTokenService..ctor(System.Uri)'.

At line:1 char:1

+ Connect-VIServer vcsa6.corp.pep.tst

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

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

    + FullyQualifiedErrorId : System.MissingMethodException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServ

   er

I thought the error was due to an invalid certificate, but running Get-PowerCLIConfiguration you can see I have it set to ignore:

PS C:\> Get-PowerCLIConfiguration

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  UseSystemProxy  Single              Ignore                    True                       300
User                     Single              Ignore
AllUsers                                     Ignore

The connect fails after I input my vCenter credentials using both AD credentials and SSO Administrator. What am I doing wrong?

Thanks in Advance!

20 Replies
Leadership
Leadership

Does your .Net version match the requirements?


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

0 Kudos
Enthusiast
Enthusiast

I didn't think to look at the .NET Framework version. I just assumed Win10 would be at the right version. I am currently at version 4.0. Let me upgrade to see if that solves my issue.

0 Kudos
Enthusiast
Enthusiast

Ok, I lied. I do have the correct version of .NET Framework installed

PS C:\WINDOWS\system32> Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 394802 }

True

0 Kudos
Enthusiast
Enthusiast

And here is my Powershell version:

PS C:\Users\xxx> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

0 Kudos
Leadership
Leadership

That looks ok.

Another question, are you providing credentials on the Connect-VIServer?

Or are you relying on SSO?


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

0 Kudos
Enthusiast
Enthusiast

I tried both and got the same result between two different 6.0 vCenters (VCSA) in different SSO domains. However, I was able to connect without error when the vCenter was 5.5.

ID Used:

AD Admin ID (VC6 & VC5.5)

SSO Admin ID (VC6)

0 Kudos
Leadership
Leadership

Can you try with disabling the proxy?

Set-PowerCLIConfiguration -ProxyPolicy NoProxy

And perhaps add a Verbose switch on the Connect-VIServer.


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

0 Kudos
Enthusiast
Enthusiast

NoProxy set but I still get the same error....

PS C:\> Set-PowerCLIConfiguration -ProxyPolicy NoProxy

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"): A

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  NoProxy         Single              Ignore                    True                       300
User                     Single              Ignore
AllUsers NoProxy                             Ignore


PS C:\> connect-viserver server.tst -Verbose
connect-viserver : Method not found: 'Void VMware.Binding.Sts.VmwareSecruityTokenService..ctor(System.Uri)'.
At line:1 char:1
+ connect-viserver server.tst -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], MissingMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServ
   er

0 Kudos
Leadership
Leadership

Out of ideas right now I'm afraid :smileycry:

Do you by any chance have a 2nd station where you could install PowerCLI 10?

And check if you see the same behaviour on all stations.


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

0 Kudos
Enthusiast
Enthusiast

That's an interesting one. This is the first time I've heard of it on PowerCLI 10.

Couple Options:

1. What happens if you specify credentials for the vCenter as part of the command?

2. You can try uninstalling all the PowerCLI modules through Uninstall-Module, or just deleting all the modules from your PowerShell module location, and re-running the Install-Module command. This wouldn't be the first time where something weird happened as part of the PowerShell Gallery install process.

3. Open a support ticket.

0 Kudos
Leadership
Leadership

In order to further investigate, can you do a Get-Module -Name VMware* -ListAvailable


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

0 Kudos
Enthusiast
Enthusiast

A couple of updates since we last talked.

1. I followed some comments on blogs.vmware.com posting about PowerCLI 10 and uninstalled any older modules.

2. I have open a service request with VMware. More to come...

3. kmruddyVMW​ - Yes, I have tried various methods of credentials (manual, $Credentials) and all produce the same result.

4. Here are the modules installed:

PS C:\> Get-Module -Name VMware* -ListAvailable


    Directory: C:\Users\XXXX\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     10.0.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script     10.0.0.... VMware.VimAutomation.Common
Script     10.0.0.... VMware.VimAutomation.Sdk            {Get-PSVersion, Get-InstallPath}


    Directory: C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     6.0.0.0    VMware.DeployAutomation
Binary     6.0.0.0    VMware.ImageBuilder
Binary     6.5.0.4... VMware.VimAutomation.Cis.Core
Binary     6.5.0.4... VMware.VimAutomation.Cloud
Manifest   6.5.0.4... VMware.VimAutomation.Common
Binary     6.5.0.2... VMware.VimAutomation.Core           HookGetViewAutoCompleter
Binary     6.0.0.0    VMware.VimAutomation.HA
Binary     7.0.2.4... VMware.VimAutomation.HorizonView
Binary     6.5.0.4... VMware.VimAutomation.License
Binary     6.5.0.4... VMware.VimAutomation.PCloud
Manifest   6.5.0.4... VMware.VimAutomation.Sdk            Get-PSVersion
Binary     6.5.0.4... VMware.VimAutomation.Storage
Binary     6.5.0.4... VMware.VimAutomation.Vds
Binary     6.5.0.4... VMware.VimAutomation.vROps
Binary     6.0.0.0    VMware.VumAutomation

0 Kudos
Leadership
Leadership

You seem to have a mix of PowerCLI 6.5.x and 10 on your system.

I would advise to first remove everything.

And then do a fresh install


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

0 Kudos
Leadership
Leadership

If the uninstall from Programs and Features doesn't remove everything, just delete the folders manually.


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

Enthusiast
Enthusiast

That was exactly my issue. Once I completely uninstalled all 6.5 components I was able to do a new install of 10 and then connect without error.

Thanks for the help! Much appreciated.

0 Kudos
Leadership
Leadership

You're welcome.
Perhaps you could mark the thread as answered, so others can find it?


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

0 Kudos
Contributor
Contributor

I was able to get this to resolve on my Windows10 platform.  I had PowerCLI 6.5 R1 installed as well as 10.0.1

  1. Closed all shell windows
  2. Opened Add/Remove Programs and removed all PowerCLI apps shown (just 6.5 in my case) and waited for that to complete
  3. Open PowerShell window (run as administrator)
  4. Run the command:  install-module -Name VMware.PowerCLI -AllowClobber
    1. note the AllowClobber switch to force overwriting any/all modules still in place
  5. Waited for that to re-download and install all the modules.
  6. re-attempted Connect-VIServer and was able to connect to my 6.0 VCSA as well are my other Windows 6.0 installs.

Hope that helps someone!

Enthusiast
Enthusiast

Get-InstalledModule | ForEach-Object {

$CurrentVersion = $PSItem.Version

Get-InstalledModule -Name $PSItem.Name -AllVersions | Where-Object -Property Version -LT $CurrentVersion

} | Uninstall-Module -Verbose -Force

close all the application and open the windows power CLI in administrator mode , Hope it works ......

0 Kudos
Contributor
Contributor

Use Connect-CisServer -Server "vcenter" instead, this works to vcenter.  Connect-VIServer only connects to the host.

0 Kudos