アプリケーションを通じて新しいデバイスが SCCM に追加されるたびに、SMS_Collection に対して RequestRefresh 関数を呼び出そうとしています。ただし、execute を呼び出すと、次の例外が発生します。
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)
ここにコードがあります
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"]);
}
}
問題は、GetMethodParameters を呼び出すと、2007 SCCM で有効な「includesubcollections」というパラメーターを持つオブジェクトが返されることですが、2012 SCCM を使用していて、RequestRefresh メソッドがそのパラメーターを使用しなくなったことです。新しい 2012 SCCM インスタンスを指しているときに、GetMethodCall が古い関数パラメーターを返すのはどうしてですか?