API Reference
SysvolEngine
Centralized helper for building SYSVOL UNC paths and reading files via a preferred (healthy) DC. Keeps callers consistent and makes it trivial to pivot to DFS when needed.
Inheritance
- Object
- SysvolEngine
Constructors
public SysvolEngine(SysvolEngineOptions options = null) #Creates a new instance of SysvolEngine.
Parameters
- options ADPlayground.Sysvol.SysvolEngineOptions = null
- Optional engine options. Defaults are used when omitted.
Methods
public IEnumerable<String> CandidatesForRelativePath(String domainName, String relativePath) #IEnumerable<String>Returns candidate UNC paths for a relative SYSVOL path, prioritizing healthy DCs.
Parameters
- domainName System.String
- relativePath System.String
public String GpoRoot(String domainName, Guid gpoId) #StringComputes the UNC path to a GPO folder identified by GUID.
Parameters
- domainName System.String
- gpoId System.Guid
public Boolean IsUncServerReachable(String uncPath) #BooleanQuickly checks whether the UNC server portion is reachable over SMB (TCP 445), honoring the negative cache. Use this before expensive File/Directory.Exists on UNC.
Parameters
- uncPath System.String
- UNC path (\\server\share\...).
Returns
True if the server appears reachable; false for unreachable/unknown.
public String PoliciesRoot(String domainName) #StringComputes the UNC path to the Policies root for the specified domain, preferring a healthy DC.
Parameters
- domainName System.String
public String PoliciesRootOnDc(String domainName, String dcName, Boolean requireReachable = true) #StringReturns the Policies root UNC for a specific DC when reachable.
Parameters
- domainName System.String
- dcName System.String
- requireReachable System.Boolean = true
public String RewriteGpoSysvolPath(String domainName, String gpcFileSysPath, Guid gpoId) #StringRewrites a gPCFileSysPath (e.g., \\dc\SYSVOL\domain\Policies\{GUID}) to a healthy DC if the original server is unreachable.
Parameters
- domainName System.String
- gpcFileSysPath System.String
- gpoId System.Guid
public String RewriteSysvolUnc(String domainName, String uncPath) #StringRewrites any SYSVOL UNC to prefer a healthy DC when appropriate. If the UNC targets a specific DC and NoFallbackOnExplicitDc is true, the path is returned unchanged even if the DC is unreachable.
Parameters
- domainName System.String
- DNS domain name (used to identify DFS vs DC UNC).
- uncPath System.String
- Original UNC path (e.g., \\DC01\SYSVOL\domain\Policies\...).
Returns
Rewritten UNC or the original when rewrite is not applicable; null when no viable candidate found.
public String TryPickExisting(String domainName, String relativePath) #StringTries to resolve a relative SYSVOL path to an existing UNC path by probing candidates.
Parameters
- domainName System.String
- relativePath System.String