I created a COM object using Powershell:

$obj = new-object -com MyLib.MyObj

Then I need to query the interface "MyLib.MyInterface" on that object, but I have no idea how to do it with PowerShell.

In other words suppose I have the below C++ code

CComPtr<IInterface1> pInterface1;
CComPtr<IInterface2> pInterface2;
pInterface1->CoCreateInstance(CLSID_XXXX);   //in PowerShell: $obj = new-object -com MyLib.MyObj
pInterface1->QueryInterface(IID_YYYY, &pInterface2); //how to do this in PowerShell?

How do I do the same job with Powershell?

Edit
Report