VMware Cloud Community
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

Fresh Install of PowerCLI failed

Hello,

I download in my laptop vmware powercli.

VMware-PowerCLI-5.5.0-1931983.exe

The installation working fine and when I launch the "VMware vSphere PowerCLI" nothing append.

I try to open Powershell and launch manually "vim.psc1" and I have this error :

PS C:\Users\User1> WARNING : The following errors occurred when loading console C:\Program Files(x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1 :

Unable to load the snap-in Windows PowerShell VMware.VimAutomation.Core due to the following error : Unable to cast an object of type 'VMware.VimAutomation.ViCore.Cmdlets.Vim4PSSnapIn' to type 'System.Management.Automation.CustomPSSnapIn'.

Unable to load the snap-in Windows PowerShell VMware.VimAutomation.Vds due to the following error : Unable to cast an object of type 'VMware.VimAutomation.Vds.Commands.VdsSnapin' to type 'System.Management.Automation.CustomPSSnapIn'.

Thank you for your help.

1 Solution

Accepted Solutions
mearldanner
Contributor
Contributor
Jump to solution

For my Windows 8.1 it was the Powershell version.

It needs to be running Powershell version 2.

I created a cmd file with the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 2 -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""

The shortcut cannot be edited because the "version 2" option takes the string past the 260 character limit.

I also had to go into Task bar properties and increase the number of items in the jump lists to 10.

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Some questions:

  • do you get the PowerCLI prompt when you start via the PowerCLI shortcut ?
  • Are the .Net prerequisites installed
  • is the execution policy of PowerShell set to RemoteSigned


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

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

Hello,

Thank you for your reply.

1) no prompt. The window open and close.

2) I have Framework 4.5.1 and Powershell 4

3) I test with Unrestricted and RemoteSigned

Thanks.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

PowerCLI still requires .Net 2, didn't you get a warning for that during the installation ?

See also the Release Notes.


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

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

No.

I can try to install PowerCLi if you want.

i remember me than at the beginning of install 2 soft installed and after that the install of powercli began.

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

I miss in my previous post.

The Framework 2.0 are correctly installed :

NET Framework 3.5 (includes .NET 2.0 and 3.0

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Ok, so the prereqs should be ok.

When you open a PowerShell prompt and type

Add-PSSnapin -Name VMware.VimAutomation.Core

what happens ?

If you do a

Get-PSSnapin | Select Name

afterwards, is the PowerCLI pssnapin returned ?


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

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

If I launch this command and I have this error :


Add-PSSnapin :Unable to load the snap-in Windows PowerShell VMware.VimAutomation.Core due to the following error : Unable to cast an object of type 'VMware.VimAutomation.ViCore.Cmdlets.Vim4PSSnapIn' to type 'System.Management.Automation.CustomPSSnapIn'.

At Character Line : 1

+ Add-PSSnapin -Name VMware.VimAutomation.Core

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

    + CategoryInfo          : InvalidData : (VMware.VimAutomation.Core:String) [Add-PSSnapin], PSSnapInException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Thanks.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

It looks as if the PowerCLI installation didn't go fine.

As a first course of action I would completely uninstall PowerCLI (and the VMRC and Vix packages PowerCLI installs).

Then reboot the system, and try a fresh install of PowerCLI.

Any difference ?


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

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

OK.

I uninstall PowerCLI, Remote Plugin and VIX.

I reboot.

I launch install file, It start by Remote Plug-In install.

After it install VIX.

After that I have the wizard for PowerCLI 5.5.0.6579.

By default it choose vSphere Power CLI and uncheck "vcloud director power cli"

Install is finish correctly.

And error persist.

I precise I have vmware workstation 10 on my laptop / vsphere client 5.5 and vmware converter standalone.

Thank you.

MariusRoma
Expert
Expert
Jump to solution

I have the same problem on a Windows 8.1 box.

Can anybody please help?

Regards

marius

0 Kudos
mearldanner
Contributor
Contributor
Jump to solution

For my Windows 8.1 it was the Powershell version.

It needs to be running Powershell version 2.

I created a cmd file with the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 2 -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -noe -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\""

The shortcut cannot be edited because the "version 2" option takes the string past the 260 character limit.

I also had to go into Task bar properties and increase the number of items in the jump lists to 10.

0 Kudos
StephaneGillier
Enthusiast
Enthusiast
Jump to solution

Hello,

I try also with version 5.8.0 and it's not fixed.

So I try your fix and it's OK now.

Thank you for your help.

0 Kudos