Examples/Sample_cNtfsPermissionsInheritance.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<#
.SYNOPSIS Disable NTFS permissions inheritance. .DESCRIPTION This example shows how to use the cNtfsPermissionsInheritance DSC resource to disable NTFS permissions inheritance. #> Configuration Sample_cNtfsPermissionsInheritance { param ( [Parameter(Mandatory = $false)] [ValidateNotNullOrEmpty()] [String] $Path = (Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([Guid]::NewGuid().Guid)) ) Import-DscResource -ModuleName cNtfsAccessControl Import-DscResource -ModuleName PSDesiredStateConfiguration File TestDirectory { Ensure = 'Present' DestinationPath = $Path Type = 'Directory' } # Disable NTFS permissions inheritance. cNtfsPermissionsInheritance DisableInheritance { Path = $Path Enabled = $false PreserveInherited = $true DependsOn = '[File]TestDirectory' } } $OutputPath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath 'Sample_cNtfsPermissionsInheritance' Sample_cNtfsPermissionsInheritance -OutputPath $OutputPath Start-DscConfiguration -Path $OutputPath -Force -Verbose -Wait |