private void DeleteUpdate(IUpdate updateToDelete) { Logger.EnteringMethod(updateToDelete.Title); try { Logger.Write(updateToDelete.UpdateSource.ToString()); wsus.DeleteUpdate(updateToDelete.Id.UpdateId); Logger.Write("Successfuly delete " + updateToDelete.Title); } catch (Exception ex) { Logger.Write("**** " + ex.Message); } }
private Dictionary <string, string> DeleteUpdate(IUpdateServer wsus, string id) { Dictionary <string, string> dict = new Dictionary <string, string>(); try { IUpdate deletedUpdate = wsus.GetUpdate(new UpdateRevisionId(new Guid(id))); if (deletedUpdate.IsApproved) { deletedUpdate.Decline(); } wsus.DeleteUpdate(new Guid(id)); dict.Add("Title", deletedUpdate.Title); dict.Add("Id", deletedUpdate.Id.UpdateId.ToString()); dict.Add("Status", "Deleted"); } catch (WsusObjectNotFoundException) { dict.Add("Id", id); dict.Add("Status", "Not Found"); } return(dict); }