如何使用c#在客户软件中心中显示部署的sccm应用程序?

时间:2018-06-05 17:35:44

标签: c# sccm

我使用的代码能够显示应用程序已部署但未显示在客户端的软件中心。

IResultObject applicationAssignment = this.sccmConnection.CreateInstance("SMS_ApplicationAssignment");
DateTime time = DateTime.Now;
//// assign the application information to the assignment
applicationAssignment["ApplicationName"].StringValue = application.PropertyList["LocalizedDisplayName"];
applicationAssignment["AssignedCI_UniqueID"].StringValue = application.PropertyList["CI_UniqueID"];
applicationAssignment["AssignedCIs"].IntegerArrayValue = new int[] { int.Parse(application.PropertyList["CI_ID"]) };
applicationAssignment["AssignmentName"].StringValue = this.txtSCCMApplicationName.Text + "_Deployment";
////use the collection name
applicationAssignment["CollectionName"].StringValue = result.PropertyList["Name"];
applicationAssignment["DisableMomAlerts"].BooleanValue = false;
applicationAssignment["AssignmentDescription"].StringValue = "Created by a web form application";
//applicationAssignment["EnforcementDeadline"].DateTimeValue = time;
applicationAssignment["NotifyUser"].BooleanValue = true;
applicationAssignment["OfferFlags"].LongValue = 2;
applicationAssignment["DesiredConfigType"].LongValue = 1;
applicationAssignment["OverrideServiceWindows"].BooleanValue = false;
applicationAssignment["RebootOutsideOfServiceWindows"].BooleanValue = false;
applicationAssignment["RequireApproval"].BooleanValue = false;
applicationAssignment["StartTime"].DateTimeValue = time;
applicationAssignment["SuppressReboot"].LongValue = 0;
applicationAssignment["OfferTypeID"].LongValue = 2;
//applicationAssignment["Priority"].LongValue = 2;
////use the collection id
applicationAssignment["TargetCollectionID"].StringValue = result.PropertyList["CollectionID"];
applicationAssignment["UseGMTTimes"].BooleanValue = false;
applicationAssignment["UserUIExperience"].BooleanValue = true;
applicationAssignment["WoLEnabled"].BooleanValue = false;
applicationAssignment["LocaleID"].LongValue = 1033;
applicationAssignment.Put();

0 个答案:

没有答案