VMware Cloud Community
agonzalezm1
Enthusiast
Enthusiast

Connect-VIServer Method not found: 'Void VMware.Vim.VimClient.set_UseSystemProxy

I am running powercli script  from .net application and this used to work in 6.5.1 but with latest version when i run powercli script from c# c.net i get this error:

Connect-VIServer                Method not found: 'Void VMware.Vim.VimClient.set_UseSystemProxy

If i run script from powershell console it works fine, just fail when runing hosted in .net.

Any idea what is wrong or has changed in 10.x?

Reply
0 Kudos
13 Replies
LucD
Leadership
Leadership

Could you be seeing the same as this Re: powercli 10 connect-viserver error method not found


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

Reply
0 Kudos
agonzalezm1
Enthusiast
Enthusiast

I previously uninstalled all modules with get-modules -listavailable vmware*|uninstall-module -force and the installed last version and continue to see same error.

Reply
0 Kudos
LucD
Leadership
Leadership

Do you still see a PowerCLI entry under Programs and Features in the Control Panel?

If yes, uninstall it.

Is there still a folder C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI?

If yes, delete it.


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

Reply
0 Kudos
agonzalezm1
Enthusiast
Enthusiast

Also if i uninstall and revert back to vmware.powercli 6.5.1 that before was working fine now it is failing also because some of dependecies ( vmware.vim, etc )  it installs new version not 6.5.1.

How can I install powercli old version so all dependecies installed are from that time also and not the newer ones?

Install-Module -Name VMware.PowerCLI -RequiredVersion 6.5.1.5377412

The result is this: so connect-vi server is in VMware.VimAutomation.Core   that is installing 10.1  so same problem

PS C:\Users\Administrator> get-module -ListAvailable *vmware*

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands

---------- -------    ----                                ----------------

Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...

Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...

Manifest   6.5.1.5... VMware.PowerCLI

Script     6.7.0.8... VMware.Vim

Script     10.1.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}

Binary     6.5.1.5... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...

Script     10.1.0.... VMware.VimAutomation.Common

Script     10.1.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...

Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo

Script     7.5.0.8... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}

Binary     6.5.1.5... VMware.VimAutomation.License        Get-LicenseDataManager

Binary     6.5.1.5... VMware.VimAutomation.PCloud         {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInsta...

Script     10.1.0.... VMware.VimAutomation.Sdk

Binary     6.5.1.5... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}

Binary     6.5.4.7... VMware.VimAutomation.Storage        {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...

Script     1.2.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore

Binary     6.5.1.5... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...

Binary     6.5.1.5... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...

Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...

Reply
0 Kudos
agonzalezm1
Enthusiast
Enthusiast

No, i dont have C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI or in panel control i dont have the old MSI installer powercli.

Reply
0 Kudos
LucD
Leadership
Leadership

The issue with INstall-Module in that way is that the VMware.PowerCLI module pulls in all the other PowerCLI modules.

But the RequiredVersion or MaximumVersion that you gave on the Install-Module cmdlet is not passed along.

You would need to bypass the VMware.PowerCLI module, and install all modules explicitly with the correct version.

You can find the list of modules, and their version, on PowerShell Gallery | VMware.PowerCLI 6.5.1.5377412


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

Reply
0 Kudos
agonzalezm1
Enthusiast
Enthusiast

yes, if i install modules manually to minimum version it works fine.

But is this going to be fixed in 10.1? Do we know what is problem in 10.1 with connect-viserver and set_proxy?

Reply
0 Kudos
LucD
Leadership
Leadership

I'm not sure if this is a general PowerCLI issue or an issue on your station.

You could try with a fresh install on another station.

If that still shows the problem I would suggest to open a SR


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

Reply
0 Kudos
agonzalezm1
Enthusiast
Enthusiast

I have tried in several machines and servers and all expose same problem.

Reply
0 Kudos
LucD
Leadership
Leadership

Then open a SR, but since you are calling this from .Net I think you will need a Developer Support Contract.


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

Reply
0 Kudos
MarkDeLo
Contributor
Contributor

I am getting the same error.

Connect-VIServer Method not found: 'Void VMware.Vim.VimClient.set_UseSystemProxy(Boolean)'.

Script runs perfect within a PowerShell Console.  But I get this error when running from .NET in a ASP NET website.

Worked fine in the site until the v11 update.  Now, no matter what version I have in, it errors.

Any ideas?

Reply
0 Kudos
MarkDeLo
Contributor
Contributor

I uninstalled all VMware.PowerCLI from my server.  Installed a very old VMware-PowerCLI-5.8.0-2057893.exe and I can connect from my web page.

Yet when I completely uninstall that one, and install anything newer, I get;

Connect-VIServer Method not found: 'Void VMware.Vim.VimClient.set_UseSystemProxy(Boolean)'

Seems like I'm missing something so simple because it runs perfectly from a PowerShell window on the same server.

Any Ideas?

Reply
0 Kudos
deloid
Contributor
Contributor

Same problem here with 10.x and 11.x when running a script from ASP.NET C#. All works fine from the console.

6.5.x (and corresponding down-rev dep modules) works perfectly.

I was using SSO on 6.5.x and it worked fine, but 10.x and 11.x both throw errors in the logs saying that the script is waiting for input, so SSO fails when running via ASP.NET.

If I swap to using exported creds in clixml, it will not throw an exception when running connect-viserver within ASP.NET, but I do see some more script-killing behavior (below) and it doesn't really connect. I haven't checked the vi server sessions though to confirm that.

I get the same 'Connect-VIServer Method not found: 'Void VMware.Vim.VimClient.set_UseSystemProxy(Boolean)'' error in the transcript when I connect, but also of note is that both $global:DefaultVIServers​ or the var I assign my connect-viserver object to are null. I did some debugging in my app to output them and it's definitely empty.

If I run subsequent commands (like Get-Datastore, etc), I get the error stating I'm not connected to any servers and to connect to one first.

Reply
0 Kudos