dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 787 forks source link

Copy-DbaAgentJob fails when trying to copy CDC jobs #9371

Closed MartinOosthuyzen closed 1 month ago

MartinOosthuyzen commented 1 month ago

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

WARNING: [14:26:30][Copy-DbaAgentJob] Issue copying job | The specified '@srv' is invalid (valid values are returned by sp_helpserver).

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

Copy-DbaAgentJob -Source DESKTOP-VVE0203\SQL2022 -Destination DESKTOP-VVE0203\SQL20221

Please confirm that you are running the most recent version of dbatools

Get-InstalledModule dbatools

Version Name Repository Description


2.1.16 dbatools PSGallery The community module that enables SQL Server Pros to automate database development and server administration

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-GDR) (KB5035432) - 16.0.1115.1 (X64) Mar 15 2024 01:13:46 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 (Build 22621: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.9241.0

niphlod commented 1 month ago

as said in slack, it's not a bug, it's not an issue, it's a problem of what you want to achieve. you can't have cdc jobs on alwayson enabled at both sides, so you need to rewrite your jobs accordingly, and not use Copy-DbaAgent for the task.

MartinOosthuyzen commented 1 month ago

Thanks, yes, manual it is then

MartinOosthuyzen commented 1 month ago

d