Examples/Resources/SPUserProfileSyncConnection/1-Example.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
<#
.EXAMPLE
    This example adds a new user profile sync connection to the specified user
    profile service app
#>


    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount,

            [Parameter(Mandatory = $true)]
            [PSCredential]
            $ConnectionAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPUserProfileSyncConnection MainDomain
            {
                UserProfileService = "User Profile Service Application"
                Forest = "contoso.com"
                Name = "Contoso"
                ConnectionCredentials = $ConnectionAccount
                Server = "server.contoso.com"
                UseSSL = $false
                IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com")
                ExcludedOUs = @("OU=Notes Usersa,DC=Contoso,DC=com")
                Force = $false
                ConnectionType = "ActiveDirectory"
                PsDscRunAsCredential = $SetupAccount
            }
        }
    }