API Reference
Class
PolicyStateService
Helpers to resolve policies and read/write their state via an IPolicySource.
Inheritance
- Object
- PolicyStateService
Methods
public static PolicyStateDetails GetDetails(IPolicySource source, PolicyDefinition policy) #Returns:
PolicyStateDetailsGets a typed details object (basic state + per-element values) for a policy.
Parameters
- source ADPlayground.Gpo.GpoLocal.IPolicySource
- policy ADPlayground.Gpo.GpoLocal.PolicyDefinition
public static PolicyValueState GetState(IPolicySource source, PolicyDefinition policy, String elementId = null) #Returns:
PolicyValueStateGets the current value state for a policy (or a specific element in multi-element policies).
Parameters
- source ADPlayground.Gpo.GpoLocal.IPolicySource
- Registry-backed policy source.
- policy ADPlayground.Gpo.GpoLocal.PolicyDefinition
- Policy definition.
- elementId System.String = null
- Optional element id. When null, uses the policy's primary element.
Returns
Configured flag and value data (when present).
public static PolicyDefinition ResolvePolicyByName(AdmxDocument doc, String policyName) #Returns:
PolicyDefinitionResolves a policy by its ADMX name.
Parameters
- doc ADPlayground.Gpo.GpoLocal.AdmxDocument
- Compiled ADMX document.
- policyName System.String
- Policy name (internal ADMX name).
Returns
The policy definition or null when not found.
public static Void SetState(IPolicySource source, PolicyDefinition policy, Nullable<Boolean> notConfigured, String valueString, String elementId = null) #Returns:
VoidSets or clears a policy value.
Parameters
- source ADPlayground.Gpo.GpoLocal.IPolicySource
- Registry-backed policy source.
- policy ADPlayground.Gpo.GpoLocal.PolicyDefinition
- Policy definition.
- notConfigured System.Nullable{System.Boolean}
- When true, clears the policy (deletes value(s)).
- valueString System.String
- Value to set (format depends on element type).
- elementId System.String = null
- Optional element id for multi-element policies.