-
Notifications
You must be signed in to change notification settings - Fork 225
SqlReplication
dscbot edited this page Oct 26, 2024
·
11 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
InstanceName | Key | String | Specifies the SQL Server instance name where replication distribution will be configured. | |
Ensure | Write | String |
'Present' will configure replication, 'Absent' will disable (remove) replication. Default value is 'Present' . |
Present , Absent
|
DistributorMode | Required | String |
'Local' - Instance will be configured as it's own distributor. 'Remote' - Instance will be configure with remote distributor (remote distributor needs to be already configured for distribution). |
Local , Remote
|
AdminLinkCredentials | Required | PSCredential | AdminLink password to be used when setting up publisher distributor relationship. | |
DistributionDBName | Write | String | Distribution database name. If the parameter DistributionMode is set to 'Local' this will be created, if 'Remote' needs to match distribution database on remote distributor. Default value is 'distributor' . |
|
RemoteDistributor | Write | String | Specifies the SQL Server network name that will be used as distributor for local instance. Required if parameter DistributionMode is set to 'Remote' . |
|
WorkingDirectory | Required | String | Publisher working directory. | |
UseTrustedConnection | Write | Boolean | Publisher security mode. Default value is $true . |
|
UninstallWithForce | Write | Boolean | Force flag for uninstall procedure. Default values is `$true´. |
The SqlReplication
DSC resource manages SQL Replication distribution
and publishing.
- Target machine must be running Windows Server 2012 or later.
- Target machine must be running SQL Server 2012 or later.
- When using the resource against an SQL Server 2022 instance, the module SqlServer v22.0.49-preview or newer must be installed.
All issues are not listed here, see here for all open issues.
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
{
SqlReplication 'distributor'
{
Ensure = 'Present'
InstanceName = 'DISTRIBUTOR' # Or 'MSSQLSERVER' for default instance.
AdminLinkCredentials = $SqlAdministratorCredential
DistributorMode = 'Local'
DistributionDBName = 'MyDistribution'
WorkingDirectory = 'C:\Temp'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
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
{
SqlReplication '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
}
}
}
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscServerPermission
- Disable-SqlDscAudit
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAudit
- Get-SqlDscAudit
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabasePermission
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscServerPermission
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscServer
- Invoke-SqlDscQuery
- New-SqlDscAudit
- Remove-SqlDscAudit
- Remove-SqlDscNode
- Remove-SqlDscTraceFlag
- Repair-SqlDscServer
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAudit
- Set-SqlDscDatabasePermission
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsSupportedFeature
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall