Examples/Sample_cLocalGroup.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

configuration Sample_cLocalGroup
{
    Import-DscResource -ModuleName cLocalGroup

    cLocalGroup LocalGroup1
    {
        Ensure = 'Present'
        GroupName = 'Group-1'
        Description = 'Created by the cLocalGroup DSC resource'
        Members = 'IIS APPPOOL\DefaultAppPool', 'NT AUTHORITY\IUSR'
    }

    cLocalGroup LocalGroup2
    {
        Ensure = 'Present'
        GroupName = 'Group-2'
        Description = 'Created by the cLocalGroup DSC resource'
        MembersToExclude = "$Env:UserDomain\Domain Users", 'Guest'
        MembersToInclude = "$Env:UserDomain\$Env:UserName", 'BUILTIN\Administrators'
    }
}

Sample_cLocalGroup -OutputPath "$Env:SystemDrive\Sample_cLocalGroup"

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

Get-DscConfiguration