commands

^

Copy-DbaDataCollector

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Copy-DbaDataCollector on GitHub.
Want to see the Bill Of Health for this command? Check out Copy-DbaDataCollector.

Synopsis

Migrates user SQL Data Collector collection sets. SQL Data Collector configuration is on the agenda, but it's hard.

Description

By default, all data collector objects are migrated. If the object already exists on the destination, it will be skipped unless -Force is used.

The -CollectionSet parameter is auto-populated for command-line completion and can be used to copy only specific objects.

Syntax

Copy-DbaDataCollector
    [-Source] <DbaInstanceParameter>
    [[-SourceSqlCredential] <PSCredential>]
    [-Destination] <DbaInstanceParameter[]>
    [[-DestinationSqlCredential] <PSCredential>]
    [[-CollectionSet] <Object[]>]
    [[-ExcludeCollectionSet] <Object[]>]
    [-NoServerReconfig]
    [-Force]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Copy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster

Copies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using Windows credentials.

Example: 2
PS C:\> Copy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred

Copies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.

Example: 3
PS C:\> Copy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -WhatIf

Shows what would happen if the command were executed.

Example: 4
PS C:\> Copy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -CollectionSet 'Server Activity', 'Table Usage Analysis'

Copies two Collection Sets, Server Activity and Table Usage Analysis, from sqlserver2014a to sqlcluster.

Required Parameters

-Source

Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.

Alias
Required True
Pipeline false
Default Value
-Destination

Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-SourceSqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-DestinationSqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-CollectionSet

The collection set(s) to process - this list is auto-populated from the server. If unspecified, all collection sets will be processed.

Alias
Required False
Pipeline false
Default Value
-ExcludeCollectionSet

The collection set(s) to exclude - this list is auto-populated from the server

Alias
Required False
Pipeline false
Default Value
-NoServerReconfig

Upcoming parameter to enable server reconfiguration

Alias
Required False
Pipeline false
Default Value False
-Force

If collection sets exists on destination server, it will be dropped and recreated.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

Alias cf
Required False
Pipeline false
Default Value