Returns: SmbShareRepairResult
Applies a share permission repair plan only when explicit write approval is provided.
Parameters
- plan ComputerX.Smb.SmbSharePermissionRepairPlan requiredposition: 0
- Plan to apply.
- allowWrite System.Boolean requiredposition: 1
- Must be true to apply the plan.
Returns
Repair result. When allowWrite is false, the result is a preview.
Examples
SmbShareRepairResult preview = SmbShareRepair.ApplySharePermissions(plan, allowWrite: false);
SmbShareRepairResult applied = SmbShareRepair.ApplySharePermissions(plan, allowWrite: true);
Returns: SmbShareRepairResult
Applies a share root ownership plan only when explicit write approval is provided.
Parameters
- plan ComputerX.Smb.SmbShareOwnershipRepairPlan requiredposition: 0
- Ownership repair plan.
- allowWrite System.Boolean requiredposition: 1
- Must be true to apply the plan.
Returns
Repair result. When allowWrite is false, the result is a preview.
Examples
SmbShareRepairResult preview = SmbShareRepair.ApplyShareRootOwner(ownerPlan, allowWrite: false);
SmbShareRepairResult applied = SmbShareRepair.ApplyShareRootOwner(ownerPlan, allowWrite: true);
Returns: SmbSharePermissionRepairPlan
Builds a share permission repair plan without applying it.
Parameters
- computerName System.String requiredposition: 0
- Target computer. Empty, null, or "." uses the local computer.
- shareName System.String requiredposition: 1
- Share whose permissions should be planned.
- desiredEntries System.Collections.Generic.IReadOnlyList{ComputerX.Smb.SmbSharePermissionDesiredEntry} requiredposition: 2
- Desired share-level permission entries.
- mode ComputerX.Smb.SmbSharePermissionRepairMode = Merge optionalposition: 3
- Merge or replace behavior.
Returns
Permission repair plan.
Examples
SmbSharePermissionRepairPlan plan = SmbShareRepair.PlanSharePermissions(
"FS01",
"Finance",
new[]
{
new SmbSharePermissionDesiredEntry { Identity = @"CONTOSO\File Admins", Rights = SmbShareRights.FullControl },
new SmbSharePermissionDesiredEntry { Identity = @"CONTOSO\Finance", Rights = SmbShareRights.Change }
},
SmbSharePermissionRepairMode.Replace);
Returns: SmbShareOwnershipRepairPlan
Builds an ownership repair plan for a share root.
Parameters
- diagnosticItem ComputerX.Smb.SmbShareDiagnosticItem requiredposition: 0
- Share diagnostic item containing share path and optional NTFS ACL evidence.
- desiredOwner System.String requiredposition: 1
- Desired owner account or SID.
Returns
Ownership repair plan.
Examples
SmbShareDiagnosticResult diagnostics = SmbShareDiagnostics.Get(
new SmbShareDiagnosticOptions { ShareNames = new[] { "Finance" } });
SmbShareOwnershipRepairPlan ownerPlan = SmbShareRepair.PlanShareRootOwner(
diagnostics.Shares[0],
@"CONTOSO\File Admins");