public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Advertisement ID"].AsString(); DateTime startTime = request.Inputs["Start Time"].AsDateTime(); int dayDuration = request.Inputs["Day Duration"].AsInt32(); int hourDuration = request.Inputs["Hour Duration"].AsInt32(); int minuteDuration = request.Inputs["Minute Duration"].AsInt32(); bool isGMT = request.Inputs["Is GMT"].AsBoolean(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { CMInterop.modifySCCMAdvertisementAddAssignmentScheduleNonReccuring(connection, objID, isGMT, dayDuration, hourDuration, minuteDuration, startTime); IResultObject col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Advertisement ID"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); String[] propertyNameChoices = CMInterop.getSCCMObjectPropertyNames(connection, "SMS_Advertisement"); foreach (String propertyName in propertyNameChoices) { if ((request.Inputs.Contains(propertyName + " : Property Type")) && (request.Inputs.Contains(propertyName + " : Property Value"))) { CMInterop.modifySCCMAdvertisement(connection, objID, request.Inputs[(propertyName + " : Property Type")].AsString(), propertyName, request.Inputs[(propertyName + " : Property Value")].AsString()); } } IResultObject col = null; col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String filter = request.Inputs["Filter"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = null; col = CMInterop.getSCCMAdvertisement(connection, filter); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Advertisement ID"].AsString(); uint flags = 0x00000000; if (request.Inputs["BATTERY_POWER"].AsBoolean()) { flags ^= BATTERY_POWER; } if (request.Inputs["RUN_FROM_CD"].AsBoolean()) { flags ^= RUN_FROM_CD; } if (request.Inputs["DOWNLOAD_FROM_CD"].AsBoolean()) { flags ^= DOWNLOAD_FROM_CD; } if (request.Inputs["RUN_FROM_LOCAL_DISPPOINT"].AsBoolean()) { flags ^= RUN_FROM_LOCAL_DISPPOINT; } if (request.Inputs["DOWNLOAD_FROM_LOCAL_DISPPOINT"].AsBoolean()) { flags ^= DOWNLOAD_FROM_LOCAL_DISPPOINT; } if (request.Inputs["DONT_RUN_NO_LOCAL_DISPPOINT"].AsBoolean()) { flags ^= DONT_RUN_NO_LOCAL_DISPPOINT; } if (request.Inputs["DOWNLOAD_FROM_REMOTE_DISPPOINT"].AsBoolean()) { flags ^= DOWNLOAD_FROM_REMOTE_DISPPOINT; } if (request.Inputs["RUN_FROM_REMOTE_DISPPOINT"].AsBoolean()) { flags ^= RUN_FROM_REMOTE_DISPPOINT; } if (request.Inputs["DOWNLOAD_ON_DEMAND_FROM_LOCAL_DP"].AsBoolean()) { flags ^= DOWNLOAD_ON_DEMAND_FROM_LOCAL_DP; } if (request.Inputs["DOWNLOAD_ON_DEMAND_FROM_REMOTE_DP"].AsBoolean()) { flags ^= DOWNLOAD_ON_DEMAND_FROM_REMOTE_DP; } if (request.Inputs["BALLOON_REMINDERS_REQUIRED"].AsBoolean()) { flags ^= BALLOON_REMINDERS_REQUIRED; } if (request.Inputs["RERUN_ALWAYS"].AsBoolean()) { flags ^= RERUN_ALWAYS; } if (request.Inputs["RERUN_NEVER"].AsBoolean()) { flags ^= RERUN_NEVER; } if (request.Inputs["RERUN_IF_FAILED"].AsBoolean()) { flags ^= RERUN_IF_FAILED; } if (request.Inputs["RERUN_IF_SUCCEEDED"].AsBoolean()) { flags ^= RERUN_IF_SUCCEEDED; } //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { String flagsString = Convert.ToString((int)flags); CMInterop.modifySCCMAdvertisement(connection, objID, "IntegerValue", "RemoteClientFlags", flagsString); IResultObject col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }
public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String objID = request.Inputs["Advertisement ID"].AsString(); uint flags = 0x00000000; if (request.Inputs["IMMEDIATE"].AsBoolean()) { flags ^= IMMEDIATE; } if (request.Inputs["ONSYSTEMSTARTUP"].AsBoolean()) { flags ^= ONSYSTEMSTARTUP; } if (request.Inputs["ONUSERLOGON"].AsBoolean()) { flags ^= ONUSERLOGON; } if (request.Inputs["ONUSERLOGOFF"].AsBoolean()) { flags ^= ONUSERLOGOFF; } if (request.Inputs["WINDOWS_CE"].AsBoolean()) { flags ^= WINDOWS_CE; } if (request.Inputs["DONOT_FALLBACK"].AsBoolean()) { flags ^= DONOT_FALLBACK; } if (request.Inputs["ENABLE_TS_FROM_CD_AND_PXE"].AsBoolean()) { flags ^= ENABLE_TS_FROM_CD_AND_PXE; } if (request.Inputs["OVERRIDE_SERVICE_WINDOWS"].AsBoolean()) { flags ^= OVERRIDE_SERVICE_WINDOWS; } if (request.Inputs["REBOOT_OUTSIDE_OF_SERVICE_WINDOWS"].AsBoolean()) { flags ^= REBOOT_OUTSIDE_OF_SERVICE_WINDOWS; } if (request.Inputs["WAKE_ON_LAN_ENABLED"].AsBoolean()) { flags ^= WAKE_ON_LAN_ENABLED; } if (request.Inputs["SHOW_PROGRESS"].AsBoolean()) { flags ^= SHOW_PROGRESS; } if (request.Inputs["NO_DISPLAY"].AsBoolean()) { flags ^= NO_DISPLAY; } if (request.Inputs["ONSLOWNET"].AsBoolean()) { flags ^= ONSLOWNET; } //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { String flagsString = Convert.ToString((int)flags); CMInterop.modifySCCMAdvertisement(connection, objID, "IntegerValue", "AdvertFlags", flagsString); IResultObject col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + objID + "'"); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }