//private void CreateUpdateMsi() //{ // Project project = // new Project("Foobar", // new PathFileAction( // @"%WindowsFolder%\notepad.exe", // "readme.txt", // "INSTALLDIR", // Return.asyncNoWait, // When.After, // Step.InstallFinalize, // new Condition("(NOT Installed) AND (UILevel > 3)")) //execute this action during the installation but only if it is not silent mode (UILevel > 3) // ); // project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); // project.SourceBaseDir = Environment.CurrentDirectory; // project.OutFileName = "setup"; // Compiler.WixLocation = ((string)Registry.GetValue(REG_PATH, "Path", null) + "CarteiroWin\\bin\\"); // Compiler.BuildMsi(project); //} //WSUS Group-Management private List <Dictionary <string, string> > GetComputerTargetGroups(IUpdateServer wsus) { List <Dictionary <string, string> > retList = new List <Dictionary <string, string> >(); ComputerTargetGroupCollection groups = new ComputerTargetGroupCollection(); groups = wsus.GetComputerTargetGroups(); foreach (IComputerTargetGroup group in groups) { Dictionary <string, string> details = new Dictionary <string, string>(); details.Add("Id", group.Id.ToString()); details.Add("Name", group.Name); retList.Add(details); } return(retList); }
public frmGroupUpdateRules(clsConfig cfgobject, clsWSUS wsusobject) { // Let the user know something is happening Cursor.Current = Cursors.WaitCursor; InitializeComponent(); cfg = cfgobject; wsus = wsusobject; // Get list of computer groups and sort it. gc = wsus.ComputerGroups; groupnames = new List <string>(); foreach (IComputerTargetGroup tg in gc) { groupnames.Add(tg.Name); } groupnames.Sort(); // Read existing group rules grouprules = cfg.GroupUpdateRules; // Update treeview with existing rules UpdateGroupUpdateRules(); // Set default display order (maximum + 1) numDisplayOrder.Value = grouprules.MaxDisplayOrder + 1; // Set this window to be marginly less wide than the current monitor Rectangle scr = Screen.FromControl(this).Bounds; // Make this window 20 pixels narrower than the current screen and centre it this.Left = 10; this.Width = scr.Width - 20; // Note the current height of the form - this will be the minimum height of the form minheight = this.Height; // Finished - reset cursor to normal Cursor.Current = Cursors.Arrow; }
public frmGroupUpdateRules(clsConfig cfgobject, clsWSUS wsusobject) { // Let the user know something is happening Cursor.Current = Cursors.WaitCursor; InitializeComponent(); cfg = cfgobject; wsus = wsusobject; // Get list of computer groups and sort it. gc = wsus.ComputerGroups; groupnames = new List<string>(); foreach (IComputerTargetGroup tg in gc) groupnames.Add(tg.Name); groupnames.Sort(); // Read existing group rules grouprules = cfg.GroupUpdateRules; // Update treeview with existing rules UpdateGroupUpdateRules(); // Set default display order (maximum + 1) numDisplayOrder.Value = grouprules.MaxDisplayOrder + 1; // Set this window to be marginly less wide than the current monitor Rectangle scr = Screen.FromControl(this).Bounds; // Make this window 20 pixels narrower than the current screen and centre it this.Left = 10; this.Width = scr.Width - 20; // Note the current height of the form - this will be the minimum height of the form minheight = this.Height; // Finished - reset cursor to normal Cursor.Current = Cursors.Arrow; }
/// <summary> /// Iterates through a collection of updates to approve /// </summary> /// <param name="update"> /// An update /// </param> /// <param name="targetGroups"> /// A collection of target groups /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="alreadyProcessed"> /// List of target groups that have already been processed /// </param> private static void ApproveUpdate( IUpdate update, ComputerTargetGroupCollection targetGroups, bool isTest, List <IComputerTargetGroup> alreadyProcessed) { foreach (IComputerTargetGroup group in targetGroups) { if (alreadyProcessed != null) { if (!alreadyProcessed.Contains(@group)) { ApproveUpdateForTargetGroup(update, @group, isTest, alreadyProcessed); alreadyProcessed.Add(@group); } } else { ApproveUpdateForTargetGroup(update, @group, isTest, null); } } }
/// <summary> /// Approves and update and checks for child target groups /// </summary> /// <param name="update"> /// An update /// </param> /// <param name="targetGroup"> /// A target group /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="alreadyProcessed"> /// List of target groups that have already been processed /// </param> public static void ApproveUpdateForTargetGroup( IUpdate update, IComputerTargetGroup targetGroup, bool isTest, List <IComputerTargetGroup> alreadyProcessed) { if (isTest) { Console.Out.WriteLine(" (TEST)" + targetGroup.Name + "."); } else { // 1.0.0.2 issue with Adobe Flash not having an installable update if (update.InstallationBehavior.IsSupported) { if (update.IsDeclined) { Console.Out.WriteLine(" " + update.Title + ": is declined."); } else { update.Approve(UpdateApprovalAction.Install, targetGroup); Console.Out.WriteLine(" " + update.Title + ": approved for install."); } } else { Console.Out.WriteLine(" " + update.Title + ": doesn't support install approval."); } } ComputerTargetGroupCollection children = targetGroup.GetChildTargetGroups(); if (children != null && children.Count > 0) { ApproveUpdate(update, children, isTest, alreadyProcessed); } }
/// <summary> /// Iterates through a collection of updates to approve /// </summary> /// <param name="update"> /// An update /// </param> /// <param name="targetGroups"> /// A collection of target groups /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="alreadyProcessed"> /// List of target groups that have already been processed /// </param> private static void ApproveUpdate( IUpdate update, ComputerTargetGroupCollection targetGroups, bool isTest, List<IComputerTargetGroup> alreadyProcessed) { foreach (IComputerTargetGroup group in targetGroups) { if (alreadyProcessed != null) { if (!alreadyProcessed.Contains(@group)) { ApproveUpdateForTargetGroup(update, @group, isTest, alreadyProcessed); alreadyProcessed.Add(@group); } } else { ApproveUpdateForTargetGroup(update, @group, isTest, null); } } }
private void getGroups() { IUpdateServer UpdateServer = getUpdateServer(mainWSUS); wsusGroups = UpdateServer.GetComputerTargetGroups(); foreach (IComputerTargetGroup wsusgroup in wsusGroups) { groups.Items.Add(new WSUSGroup(wsusgroup)); } }