Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/784ef125fa433204529f to your computer and use it in GitHub Desktop.
Save guitarrapc/784ef125fa433204529f to your computer and use it in GitHub Desktop.
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