public void Execute(IActivityRequest request, IActivityResponse response) { SCCMServer = settings.SCCMSERVER; userName = settings.UserName; password = settings.Password; String advID = request.Inputs["Existing Advertisement ID"].AsString(); //Setup WQL Connection and WMI Management Scope WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password); using (connection) { IResultObject col = CMInterop.getSCCMAdvertisement(connection, "AdvertisementID LIKE '" + advID + "'"); CMInterop.deleteSCCMAdvertisement(connection, advID); if (col != null) { response.WithFiltering().PublishRange(getObjects(col)); } response.Publish("Number of Advertisements", ObjCount); } }