title: Invalid method parameters when trying to call RequestRefresh from C# to SCCM server
body: <p>I'm trying to call the RequestRefresh function against SMS_Collection anytime a new device is added to SCCM through our application.  However when I call execute I get the following exception.</p>
  
  <pre><code>Main: Unrecoverable Service Error.|System.Management.ManagementException Invalid method Parameter(s)
  at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
  at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
  at SccmProxy.Adapter.RefreshCollection(String collectionName) in c:\ws\development\SCCMAgent\Main\SccmProxy\SccmProxy\Adapter.cs:line 733
  at SccmProxy.TestHelper.ExecuteTest(ProxyConfiguration config) in c:\ws\development\SCCMAgent\Main\SccmProxy\SccmProxy\TestHelper.cs:line 144
  at SccmProxy.Service.Main() in c:\ws\development\SCCMAgent\Main\SccmProxy\SccmProxy\Service.cs:line 134 Void ThrowWithExtendedInfo(System.Management.ManagementStatus)
  </code></pre>
  
  <p>Here is the code</p>
  
  <pre><code>ManagementPath pathMethod = new ManagementPath("SMS_Collection");
  using (ManagementClass processClass = new ManagementClass(this.Configuration.NewTargetScope, pathMethod, null))
  {
     ManagementBaseObject inParams = processClass.GetMethodParameters("RequestRefresh");
  
     using (ManagementBaseObject outParams = processClass.InvokeMethod("RequestRefresh", inParams, null))
     {
         LOGGER.Info(MethodBase.GetCurrentMethod().Name, "Successful collection refresh: {0}", outParams["ReturnValue"]);
     }
   }
  </code></pre>
  
  <p>The problem is that when I call GetMethodParameters it returns an object with a parameter called "includesubcollections" which is valid for 2007 SCCM but I'm using 2012 SCCM and the RequestRefresh method doesn't use that parameter anymore.  How is it that the GetMethodCall is returning the old function parameter when I have it pointing to the new 2012 SCCM instance?</p>