Examples/Sample_cLocalFileShare.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
42
43
44
45
46

configuration Sample_cLocalFileShare
{
    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Import-DscResource -ModuleName cLocalFileShare

    File TestDirectory
    {
        Ensure = 'Present'
        DestinationPath = 'C:\TestDirectory'
        Type = 'Directory'
    }

    cLocalFileShare Share1
    {
        Ensure = 'Present'
        Name = 'Share-1'
        Path = 'C:\TestDirectory'
        Description = 'Created by the cLocalFileShare DSC resource'
        ConcurrentUserLimit = 10
        FullAccess = 'NT AUTHORITY\SYSTEM'
        ChangeAccess = 'BUILTIN\Administrators'
        ReadAccess = 'NT AUTHORITY\Authenticated Users'
        NoAccess = 'BUILTIN\Guests'
        DependsOn = '[File]TestDirectory'
    }

    cLocalFileShare Share2
    {
        Ensure = 'Present'
        Name = 'Share-2'
        Path = 'C:\TestDirectory'
        ConcurrentUserLimit = 0
        Description = 'Created by the cLocalFileShare DSC resource'
        ReadAccess = 'Everyone'
        DependsOn = '[File]TestDirectory'
    }
}

Sample_cLocalFileShare -OutputPath "$Env:SystemDrive\Sample_cLocalFileShare"

Start-DscConfiguration -Path "$Env:SystemDrive\Sample_cLocalFileShare" -Force -Verbose -Wait

Get-DscConfiguration