API Reference
LocalSecurityTemplateAuthor
Typed authoring API for Local GPO Security Template (GptTmpl.inf) — user rights, basic audit, and security options. Provides fluent helpers plus lightweight validation/readback.
Inheritance
- Object
- LocalSecurityTemplateAuthor
Methods
public LocalSecurityTemplateAuthor AppendUserRightAccounts(String rightName, IEnumerable<String> accounts) #LocalSecurityTemplateAuthorAppends account names to an existing user right assignment (resolves to SID).
Parameters
- rightName System.String
- accounts System.Collections.Generic.IEnumerable{System.String}
public LocalSecurityTemplateAuthor ClearUserRight(String rightName) #LocalSecurityTemplateAuthorClears all principals from a specific user right assignment.
Parameters
- rightName System.String
public static LocalSecurityTemplateAuthor Open() #LocalSecurityTemplateAuthorOpens the local machine Security Template (GptTmpl.inf).
public static LocalSecurityTemplateAuthor Open(String templatePath) #LocalSecurityTemplateAuthorOpens a specific Security Template file path (for testing or offline authoring).
Parameters
- templatePath System.String
public LocalSecurityTemplateAuthor RemoveUserRightAccounts(String rightName, IEnumerable<String> accounts) #LocalSecurityTemplateAuthorRemoves account names (by SID resolution) from an existing user right assignment.
Parameters
- rightName System.String
- accounts System.Collections.Generic.IEnumerable{System.String}
public LocalSecurityTemplateAuthor SetBasicAudit(String categoryKey, Boolean success, Boolean failure) #LocalSecurityTemplateAuthorSets a legacy/basic audit category flag (Audit Policy section).
Parameters
- categoryKey System.String
- success System.Boolean
- failure System.Boolean
public LocalSecurityTemplateAuthor SetBasicAuditByName(String displayName, Boolean success, Boolean failure) #LocalSecurityTemplateAuthorSets a basic audit policy by friendly display name (maps to internal key).
Parameters
- displayName System.String
- success System.Boolean
- failure System.Boolean
public LocalSecurityTemplateAuthor SetSecurityOption(String section, String key, String value) #LocalSecurityTemplateAuthorSets a security option (System Access or others). Caller provides section and key.
Parameters
- section System.String
- key System.String
- value System.String
public LocalSecurityTemplateAuthor SetSystemAccess(String key, Int32 value) #LocalSecurityTemplateAuthorSets a numeric System Access option (e.g., MinimumPasswordLength, LockoutBadCount).
Parameters
- key System.String
- value System.Int32
public LocalSecurityTemplateAuthor SetSystemAccess(String key, String value) #LocalSecurityTemplateAuthorSets a string System Access option (e.g., NewAdministratorName).
Parameters
- key System.String
- value System.String
public LocalSecurityTemplateAuthor SetUserRight(String rightName, IEnumerable<String> sids) #LocalSecurityTemplateAuthorSets a user right assignment value (Privilege Rights section) with a comma-separated SID list.
Parameters
- rightName System.String
- sids System.Collections.Generic.IEnumerable{System.String}
public LocalSecurityTemplateAuthor SetUserRight(String rightName, params String[] sids) #LocalSecurityTemplateAuthorSets a user right assignment value from SIDs.
Parameters
- rightName System.String
- sids System.String[]
public LocalSecurityTemplateAuthor SetUserRightAccounts(String rightName, IEnumerable<String> accounts) #LocalSecurityTemplateAuthorResolves account names (DOMAIN\\Name or local) to SIDs and sets a user right assignment.
Parameters
- rightName System.String
- accounts System.Collections.Generic.IEnumerable{System.String}
public Validation Validate() #ValidationValidates current in-memory template by projecting common sections into typed outputs.