I've just installed PowerCLI (VMWare PowerShell integration) and successfully created a PowerShell script to connect to an ESX server (and verified it works). I've also tried it from the command line without issues.
The issue is when I try to use this as an APM component it gives an error:
Add-PSSnapin : The type initializer for 'VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory' threw an exception.
At line:1 char:13
+ Add-PSSnapin <<<< -Name VMware.VimAutomation.Core
+ CategoryInfo : NotSpecified: (:) [Add-PSSnapin], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.PowerShell.Commands.AddPSSnapinCommand
All the script has is:
Add-PSSnapin -Name VMware.VimAutomation.Core
I'm setting the script to run against the local Orion server since that is where PowerCLI is installed. If I remove that line the script runs but complains about the VMWare cmdlet not being known (which is expected if I'm not including the snap-in).
Any reason why adding the snap-in fails? I've even run "
Get-PSSnapin -registered" (from APM PowerShell component) and it shows VMware.VimAutomation.Core as registered.