Tech Community Live: Microsoft Intune
Oct 01 2024, 07:30 AM - 11:30 AM (PDT)
Microsoft Tech Community

updating content of the application in SCCM using WMI

Copper Contributor

Hi,

I wan to Call Update Content API on Application in Sccm  using WMI Object.

 

I tried with below code 

ManagementPath MgmtPath1 = new ManagementPath($"SMS_SoftwareUpdatesPackage.PackageID='{applicationID}'");
ManagementClass ProcessClass1 = new ManagementClass(Scope, MgmtPath1, null);

ManagementObject managementObject = ProcessClass1.CreateInstance();
if (managementObject != null)
{
var inParams = managementObject.GetMethodParameters("AddUpdateContent");
inParams.Properties["ContentIDs"].Value = new UInt32[] { };
inParams.Properties["ContentSourcePath"].Value =
new String[] { @"\\LocalHost\publish\7-Zip (x64)\16\4\" };
inParams.Properties["bRefreshDPs"].Value = false;

ManagementBaseObject outParams1 = managementObject.InvokeMethod("AddUpdateContent", null, null); ///An Exception is thrown here
}

 

But it is throwing an Error "Invalid Method Param(s)" or "Not Found" Exception .

Am I Missing here anything? what would be the best way to call it?

 

 

Sidaramappa_0-1711117659014.png

 

 

1 Reply