Skip to content

SPUserProfileSyncConnection

dscbot edited this page Mar 17, 2023 · 18 revisions

SPUserProfileSyncConnection

Parameters

Parameter Attribute DataType Description Allowed Values
Name Key String The name of the connection
Forest Required String The name of the AD forest to read from
UserProfileService Required String The name of the user profile service that this connection is attached to
ConnectionCredentials Required PSCredential The credentials to connect to Active Directory with
IncludedOUs Required StringArray[] A list of the OUs to import users from. For SharePoint 2016/2019 existing OUs will not be removed if not included in this list. Use ExludedOUs for removing OUs in SharePoint 2016/2019
ExcludedOUs Write StringArray[] A list of the OUs to ignore users from. For SharePoint 2016/2019 matching existing OUs to include are removed.
Server Write String The specific AD server to connect to
Port Write UInt32 The specific port to connect to
UseSSL Write Boolean Should SSL be used for the connection
UseDisabledFilter Write Boolean Should disabled accounts be filtered
Force Write Boolean Set to true to run the set method on every call to this resource. Only has effect on SharePoint 2013
ConnectionType Write String The type of the connection - currently only Active Directory is supported ActiveDirectory, BusinessDataCatalog
Ensure Write String Present if the connection should exist, absent if it should not Present, Absent

Description

Type: Distributed Requires CredSSP: No

This resource will ensure a specifc user profile sync connection is in place and that it is configured accordingly to its definition

This resource currently supports AD only.

Force only works with SharePoint 2013. For SharePoint 2016/2019 the resource is not able to remove existing OUs. You will have to use the ExcludedOUs for this. This means you need to know which OUs to remove. If any extra OUs exists after the configuration has run the test method will report the resource not in desired state.

Examples

Example 1

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
        }
    }
}
Clone this wiki locally