public override bool Parse(XElement xml) { if (xml == null) { return(false); } int id = 0; string name = string.Empty; GroupPolicy policy = GroupPolicy.OpenSource; string shortDescr = string.Empty; string descr = string.Empty; int creatorID = 0; int numOfSnippets = 0; xml.ParseNode("ID", ref id, false); xml.ParseNode("Name", ref name, false); xml.ParseNode <GroupPolicy>("Policy", ref policy, false); xml.ParseNode("ShortDescription", ref shortDescr, false); xml.ParseNode("Description", ref descr, false); xml.ParseNode("CreatorID", ref creatorID, false); xml.ParseNode("NumOfSnippets", ref numOfSnippets, false); xml.ParseNode("MembersCount", ref m_membersCount, false); GroupPreferences prefs = new GroupPreferences(xml.GetNode("pref", false)); Init(id, name, policy, prefs, shortDescr, descr, creatorID, numOfSnippets); return(true); }
private static void PrintLocalGroupPolicy() { try { Beaprint.MainPrint("Display Local Group Policy settings - local users/machine"); var infos = GroupPolicy.GetLocalGroupPolicyInfos(); foreach (var info in infos) { Beaprint.NoColorPrint($" Type : {info.GPOType}\n" + $" Display Name : {info.DisplayName}\n" + $" Name : {info.GPOName}\n" + $" Extensions : {info.Extensions}\n" + $" File Sys Path : {info.FileSysPath}\n" + $" Link : {info.Link}\n" + $" GPO Link : {info.GPOLink.GetDescription()}\n" + $" Options : {info.Options.GetDescription()}\n"); Beaprint.PrintLineSeparator(); } } catch (Exception ex) { } }
/// <summary> /// This is the complete init method for this class. /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="policy"></param> /// <param name="prefs"></param> /// <param name="shortDescr"></param> /// <param name="description"></param> /// <param name="creatorID"></param> /// <param name="numOfSnippets"></param> protected void Init(int id, string name, GroupPolicy policy, GroupPreferences prefs, string shortDescr, string description, int creatorID, int numOfSnippets) { ID = id; Name = name; Policy = policy; Preferences = prefs; ShortDescription = shortDescr; Description = description; CreatorID = creatorID; NumOfSnippets = numOfSnippets; }
///////////////////////////////////////////////////////////////////////////////////////////////////// #region Create/Add/Modify/Delete Methods ///////////////////////////////////////////////////////////////////////////////////////////////////// public int CreateGroup(string name, int adminID, GroupPolicy policy, GroupPreferences preferences, string shortDescription, string description) { throw new NotImplementedException(); }
public void Optimize() { GroupPolicy.SetPolicySetting(key, item, value, RegistryValueKind.DWord); }
public bool NeedOptimize() { return(GroupPolicy.GetPolicySetting(key, item)?.ToString() != value); }
/// <summary> /// This is the complete init method for this class. /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="policy"></param> /// <param name="prefs"></param> /// <param name="shortDescr"></param> /// <param name="description"></param> /// <param name="creatorID"></param> /// <param name="numOfSnippets"></param> protected void Init(int id, string name, GroupPolicy policy, GroupPreferences prefs, string shortDescr, string description, int creatorID, int numOfSnippets) { ID = id; Name = name; Policy = policy; Preferences = prefs; ShortDescription = shortDescr; Description = description; CreatorID = creatorID; NumOfSnippets = numOfSnippets; }
public bool AddGroupRule(GroupPolicy obj) { return(AddGroupPolicy(obj.GroupName, obj.PolicyName)); }