Long time stackoverflow reader, first time poster. Forgive me if I'm not asking a question correctly.
I'm trying to use the VixCOM API with PowerShell. I don't have much experience with either. I am aware of VMWareTasks: C# VixCOM wrapper library & tools . I've used it with success, but would like to use the VixCOM API directly for reasons I don't want to get into at the moment. I may end up using the VMWareTasks wrapper, but humor me while I try to understand the issue at hand.
My script is:
$vixLib = New-Object -ComObject VixCOM.VixLib
$job = $vixLib.Connect(-1, 10, "https://esx-server/sdk", 0, "admin", "password", 0, $null, $null)
When I run this script from PowerCLI, I get an error:
Exception calling "Connect" with "9" argument(s): "Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"
At D:\dev\PowerShell\Automated Deploy\UsingVixCOM.ps1:11 char:23
+ $job = $vixLib.Connect <<<< (-1, 10, "https://esx-server/sdk", 0, "admin", "password", 0, $null, $null)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
- Which parameter is causing the type mismatch?
- What is the proper way to call the Connect method?