Skip to content

SqlServerReplication

johlju edited this page Jun 9, 2020 · 1 revision

SqlServerReplication

Parameters

Parameter Attribute DataType Description Allowed Values
InstanceName Key String SQL Server instance name where replication distribution will be configured
Ensure Write String Present, Absent
DistributorMode Required String Local, Remote
AdminLinkCredentials Required PSCredential Distributor administration link password
DistributionDBName Write String Distribution database name
RemoteDistributor Write String Distributor server name if configuring publisher with remote distributor
WorkingDirectory Required String Publisher working directory
UseTrustedConnection Write Boolean Publisher security mode
UninstallWithForce Write Boolean Force flag for uninstall procedure

Description

The SqlReplication DSC resource manage SQL Replication distribution and publishing.

Requirements

  • Target machine must be running Windows Server 2012 or later.
  • Target machine must be running SQL Server 2012 or later.

Known issues

All issues are not listed here, see here for all open issues.

Examples

Example 1

This example shows how to configure a SQL Server instance as the distributor.

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        $SqlAdministratorCredential
    )

    Import-DscResource -ModuleName 'SqlServerDsc'

    node localhost
    {
        SqlServerReplication 'distributor'
        {
            Ensure               = 'Present'
            InstanceName         = 'DISTRIBUTOR' # Or 'MSSQLSERVER' for default instance.
            AdminLinkCredentials = $SqlAdministratorCredential
            DistributorMode      = 'Local'
            DistributionDBName   = 'MyDistribution'
            WorkingDirectory     = 'C:\Temp'

            PsDscRunAsCredential = $SqlAdministratorCredential
        }
    }
}

Example 2

This example shows how to configure a SQL Server instance as the publisher.

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        $SqlAdministratorCredential
    )

    Import-DscResource -ModuleName 'SqlServerDsc'

    node localhost
    {
        SqlServerReplication 'publisher'
        {
            Ensure               = 'Present'
            InstanceName         = 'PUBLISHER' # Or 'MSSQLSERVER' for default instance.
            AdminLinkCredentials = $SqlAdministratorCredential
            DistributorMode      = 'Remote'
            DistributionDBName   = 'MyDistribution'
            RemoteDistributor    = 'distsqlsrv.company.local\DISTRIBUTOR'
            WorkingDirectory     = 'C:\Temp'

            PsDscRunAsCredential = $SqlAdministratorCredential
        }
    }
}
Clone this wiki locally