first commit
This commit is contained in:
54
Exercise Files/01_04/01_04.ps1
Executable file
54
Exercise Files/01_04/01_04.ps1
Executable file
@@ -0,0 +1,54 @@
|
||||
Install-Module xSmbShare
|
||||
|
||||
Install-Module cNtfsAccessControl
|
||||
|
||||
Configuration SMBPull
|
||||
{
|
||||
Import-DscResource -ModuleName PSDesiredStateConfiguration
|
||||
Import-DscResource -ModuleName xSmbShare
|
||||
Import-DscResource -ModuleName cNtfsAccessControl
|
||||
|
||||
Node localhost
|
||||
{
|
||||
|
||||
File CreateFolder
|
||||
{
|
||||
DestinationPath = 'C:\DSCSMB'
|
||||
Type = 'Directory'
|
||||
Ensure = 'Present'
|
||||
}
|
||||
|
||||
xSMBShare CreateShare
|
||||
{
|
||||
Name = 'DscSmbPull'
|
||||
Path = 'C:\DSCSMB'
|
||||
FullAccess = 'landonhotel\administrator'
|
||||
ReadAccess = 'landonhotel\srv02$'
|
||||
FolderEnumerationMode = 'AccessBased'
|
||||
Ensure = 'Present'
|
||||
DependsOn = '[File]CreateFolder'
|
||||
}
|
||||
|
||||
cNtfsPermissionEntry PermissionSet1
|
||||
{
|
||||
Ensure = 'Present'
|
||||
Path = 'C:\DSCSMB'
|
||||
Principal = 'landonhotel\srv02$'
|
||||
AccessControlInformation = @(
|
||||
cNtfsAccessControlInformation
|
||||
{
|
||||
AccessControlType = 'Allow'
|
||||
FileSystemRights = 'ReadAndExecute'
|
||||
Inheritance = 'ThisFolderSubfoldersAndFiles'
|
||||
NoPropagateInherit = $false
|
||||
}
|
||||
)
|
||||
DependsOn = '[File]CreateFolder'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SmbPull
|
||||
|
||||
Start-DscConfiguration -Path SmbPull -Wait -Verbose
|
||||
|
||||
Reference in New Issue
Block a user