title: OCX/COM: Some methods do not show up in PowerShell
body: <p>I have the ActiveX control SetACL.ocx. It is registered on my system and I can use it from C# (Visual Studio 2010) without problems. Visual Studio's Object Browser displays all methods.</p>
  
  <p>In PowerShell, however, about a third of the methods are not displayed. If I try to call one of the missing methods I get MethodNotFound:</p>
  
  <pre><code>PS C:\&gt; $setacl = New-Object -ComObject setacl.setaclctrl.1
  PS C:\&gt; $setacl | Get-Member
  
     TypeName: System.__ComObject#{85869435-0ee3-440b-bf69-6c52c6638073}
  
  Name                   MemberType Definition
  ----                   ---------- ----------
  AddACE                 Method     int AddACE (string, bool, string, int, bool, int, int)
  AddDomain              Method     int AddDomain (string, string, int, bool, bool)
  AddTrustee             Method     int AddTrustee (string, string, bool, bool, int, bool, bool)
  GetLastAPIError        Method     int GetLastAPIError ()
  GetLastAPIErrorMessage Method     string ()
  GetLastListOutput      Method     string GetLastListOutput ()
  GetResourceString      Method     string GetResourceString (int)
  Reset                  Method     void Reset ()
  Run                    Method     int Run ()
  SetAction              Method     int SetAction (int)
  SetListOptions         Method     int SetListOptions (int, int, bool, int)
  SetLogFile             Method     int SetLogFile (string)
  SetOwner               Method     int SetOwner (string, bool)
  SetPrimaryGroup        Method     int SetPrimaryGroup (string, bool)
  
  
  PS C:\&gt; $setacl.SetObject("test", 1)
  Method invocation failed because [System.__ComObject#{85869435-0ee3-440b-bf69-6c52c6638073}] doesn't contain a method named 'SetObject'.
  At line:1 char:18
  + $setacl.SetObject &lt;&lt;&lt;&lt; ("test", 1)
      + CategoryInfo          : InvalidOperation: (SetObject:String) [], RuntimeException
      + FullyQualifiedErrorId : MethodNotFound
  </code></pre>
  
  <p><strong>Any clues as to why PowerShell does not show all available methods but Visual Studio's Object Browser does?</strong></p>
  
  <p>I tried both the 32- and 64-bit versions of PowerShell.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>Here is the signature of one of the missing methods from the ODL file (yes, I have the full source code of the OCX, I am its author):</p>
  
  <pre><code>[id(2), helpstring ("Set the object on which all actions are to be performed")]
  LONG SetObject(BSTR sObjectPath, LONG nObjectType);
  </code></pre>
  
  <p><strong>Update 2:</strong></p>
  
  <p>Here is the <a href="http://setacl.svn.sourceforge.net/viewvc/setacl/code/interface-activex/" rel="nofollow">source code of the OCX</a>, directly browsable on sourceforge.</p>
  
  <p><strong>Update 3:</strong></p>
  
  <p>The OCX can be <a href="https://sourceforge.net/projects/setacl/files/" rel="nofollow">downloaded from sourceforge</a>. It is included in the file SetACL 2.2.0.zip.</p>
  
  <p><strong>Update 4 - possible solution:</strong></p>
  
  <p>Changing the methods with the DISPIDs 1-7 to higher DISPIDS and introducing 7 new dummy methods with DISPIDS 1-7 seems to do the trick. Now everything shows up in PoSh - except the dummy methods.</p>
  
  <p>Does anyone have an explanation for this?</p>