title: COM interface wrappers in PowerShell?
body: <p>I have the following code in C# which I try to port to PowerShell.
  But I don't know how to port this cast:</p>
  
  <pre><code>((_ISkypeEvents_Event)skype).CallStatus += CallStatusHandler;
  </code></pre>
  
  <p>If I just type [Skype4COM.ISkypeEvents_Event] in my PowerShell console I get:</p>
  
  <blockquote>
    <p>Unable to find type [Skype4COM.ISkypeEvents_Event]: make sure that the assembly containing this type is loaded.</p>
  </blockquote>
  
  <p>However, I can get all the members of the $skype object:</p>
  
  <pre><code>$skype = New-Object -ComObject Skype4COM.Skype
  </code></pre>
  
  <p>The following line doesn't work:</p>
  
  <pre><code>$skypeevent = [Skype4COM._ISkypeEvents_Event]$skype
  </code></pre>
  
  <p>If I try to call the method directly on the $skype object, like this:</p>
  
  <pre><code>$skype.add_CallStatus({ write-host "yay" })
  </code></pre>
  
  <p>...it (as expected) tells me that:</p>
  
  <blockquote>
    <p>Method invocation failed because [System.__ComObject#{b1878bfe-53d3-402e-8c86-190b19af70d5}] doesn't contain a method named 'add_CallStatus'.</p>
  </blockquote>
  
  <p>I've tried to create a COM wrapper, but it still fails on getting the type for the COM interface...</p>
  
  <p>Any ideas? Big thanks!</p>