Examples/Resources/SPFarmAdministrators/2-SetIncludeExcludeAdmins.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
<#
.EXAMPLE
    This example shows how certain changes are made to the farm admins groups. Here any
    members in the MembersToInclude property are added, and members in the MembersToExclude
    property are removed. Any members that exist in the farm admins group that aren't listed
    in either of these properties are left alone.
#>


    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPFarmAdministrators LocalFarmAdmins
            {
                Name                 = "Farm Administrators"
                MembersToInclude     = @("CONTOSO\user1")
                MembersToExclude     = @("CONTOSO\user2")
                PsDscRunAsCredential = $SetupAccount
            }
        }
    }