So I decided to upgrade my PowerCLI 5.5 R2 Patch 1 to the latest 5.8, released last week or so. (yeah, I know, I guess I decided to live dangerously, using brand new versions :-)) And the upgrade installation went fine. But when I start PowerCLI, I am getting:
Add-PSSnapin : The type initializer for 'VMware.VimAutomation.Storage.Interop.V1.Service.StorageServiceFactory' threw an exception.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:48 char:10
+ Add-PSSnapin $snapin
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-PSSnapin], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Anybody know why? I didn't update the vSphere CLI, just PowerCLI. I was still able to connect to my vCenter (I connect to my vCenter in my profile). But I don't know what won't work. I did a quick "Get-VMHost", "Get-VM" and a few others - they all worked fine.
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18444
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.8 Release 1 build 2057893
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.5 build 1983942
VMWare ImageBuilder PowerCLI Component 5.5 build 1983942
VMware License PowerCLI Component 5.5 build 1265954
VMware Storage PowerCLI Component 5.8 build 2057894
VMware VDS PowerCLI Component 5.8 build 2031581
VMware vSphere PowerCLI Component 5.8 build 2031581
VMware vSphere Update Manager PowerCLI 5.1 build 782803
Ideas, anyone? Should I roll back to 5.5? Anyone else having any issues?
An update. We upgraded our environment to 5.5 (vCenter and all ESXi hosts). As such, I upgraded my fat client installation. Then I decided to again try updating my Powershell to 5.8.
And then it all Just Worked. No errors on starting Powershell. Everything responding as it should.
Can't imagine why the 2 would be related, but regardless, I am now running 5.8 on my Win 7 workstation.
I assume you did an upgrade in place ?
Did you already try completely uninstalling PowerCLI, and then installing the 5.8 R1 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, it was an upgrade in place, from 5.5 R2 Patch 1 to 5.8 R1. That showed the error above.
When I got the error, I then tried uninstalling PowerCLI, re-downloaded 5.8 R1 (just in case), and then re-installed.
Same error.
Did you also uninstall VIX and VMRC ?
And did you reboot before doing the new install ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did not uninstall VIX. Don't know what VMRC is, so I didn't uninstall that, either. 🙂 It didn't ask recomened uninstalling, so I didn't. It didn't ask for a reboot, so I didn't do one ....
I then tried uninstalling PowerCLI, VIX and VMRC. Rebooted. Installed PowerCLI 5.8R1. (it then installed VIX and VMRC; it installed VMRC 5.1, same version I uninstalled :-)).
Same error.
Add-PSSnapin : The type initializer for 'VMware.VimAutomation.Storage.Interop.V1.Service.StorageServiceFactory' threw an exception.
At C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1:48 char:10
+ Add-PSSnapin $snapin
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-PSSnapin], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.AddPSSnapinCommand
I removed 5.8R1 and re-installed 5.5 R2 Patch 1. Startup error went away, and a script that used to run fine in 5.5, but errored out under 5.8, now also completes again.
(see the thread about "Site Recovery Manager Configuration script - using 5.5 R2 P1, it works perfectly. Not changing the script, but updating to 5.8R1, and the script stops, with "underlying connection has broken" when doing a Get-Datastore)
I'll just wait for the next release. I am still running ESXi 5.1U1, anyway. Once I get all my hosts to 5.5, maybe I'll try updating PowerCLI again.
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.5 Release 2 Patch 1 build 1931983
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.5 build 1890764
VMWare ImageBuilder PowerCLI Component 5.5 build 1890764
VMware License PowerCLI Component 5.5 build 1265954
VMware VDS PowerCLI Component 5.5 build 1926677
VMware vSphere PowerCLI Component 5.5 Patch 1 build 1926677
Please can you confirm the OS version and SP please
Win 7 Pro SP1, 32bit
Michael, would it be possible for you to export and share with us the windows eventlogs on the machine where you got this error? This looks like a problem with the installer and we'd like to investigate it further.
Thanks,
Alex
BTW, on a different system (Win 2012 R2), I did the same upgrade procedure from 5.5 R2 P1 to 5.8R1, and it worked perfectly. No errors. (I did click "Run As Administrator" when installing 5.8 R1; don't recall if I did the same on the system that failed. I think I did. But I didn't uninstall anything first.
Hi Mike,
Did the issue for PowerCLI 5.8 Release 1 resolved. Can i upgrade to 5.8 R1 without any issue on Win7 workstation?
thanks
vm2014
I never heard anything more about my issue (as you can see in this thread). So on my main Win 7 workstation, I am still running PowerCLI 5.5 R2 P1. On a Win2012 server I set up, PowerCLI 5.8 R1 installed with no problem.
So I don't know what to advise you to do about upgrading.
I'm having the same issue as you on Windows 7 64-bit. Same PS version.
According to the link below, this snapin is new and adds cmdlets for storage based policy management, so if you don't intend on using any of those it's probably safe to ignore the error. Or you could edit Initialize-PowerCLIEnvironment.ps1 and remove "VMware.VimAutomation.Storage" from line 40 like I did.
New Release: VMware vSphere PowerCLI 5.8 Release 1 | VMware PowerCLI Blog - VMware Blogs
An update. We upgraded our environment to 5.5 (vCenter and all ESXi hosts). As such, I upgraded my fat client installation. Then I decided to again try updating my Powershell to 5.8.
And then it all Just Worked. No errors on starting Powershell. Everything responding as it should.
Can't imagine why the 2 would be related, but regardless, I am now running 5.8 on my Win 7 workstation.