Skip to content

Instantly share code, notes, and snippets.

@guitarrapc guitarrapc/ACLReverse.ps1
Last active Aug 29, 2015

Embed
What would you like to do?
ACL Sample
configuration ACLTest
{
$path = "C:\ACL";
$hogePath = Join-Path $path "hoge";
$fugaPath = Join-Path $path "fuga";
Import-DSCResource -ModuleName GraniResource;
Node localhost
{
File ACL
{
DestinationPath = $path;
Ensure = "Present";
Type = "Directory";
Force = $true;
}
File Hoge
{
DestinationPath = $hogePath;
Ensure = "Present";
Type = "Directory";
Force = $true;
DependsOn = "[File]ACL";
}
File Fuga
{
DestinationPath = $fugaPath;
Ensure = "Present";
Type = "Directory";
Force = $true;
DependsOn = "[File]ACL";
}
#region Hoge Directory ACL
cInheritACL hogeInheritACL
{
Path = $hogePath;
IsProtected = $false; #継承をする
PreserveInheritance = $true;
DependsOn = "[File]Hoge";
}
cACL hogeACL
{
Path = $hogePath;
Account = "Everyone";
Rights = "FullControl";
Ensure = "Present";
Strict = $true;
DependsOn = "[cInheritACL]hogeInheritACL";
}
#endregion
#region Fuga Directory ACL
cInheritACL fugaInheritACL
{
Path = $fugaPath;
IsProtected = $false; #継承をもどす!
PreserveInheritance = $true; #継承破棄した際に、継承元のアクセス許可を個別のアクセス許可として明示的に持つ
DependsOn = "[File]Fuga";
}
#endregion
}
}
ACLTest -OutputPath c:\hoge;
Start-DscConfiguration -Path c:\hoge -Verbose -Force -Wait;
# Test
Test-DSCConfiguration;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.