Skip to content

Copy-DbaLinkedServer - Fix issues when migrating to SQL Server 2025#10355

Merged
potatoqualitee merged 1 commit intodevelopmentfrom
fix_Copy-DbaLinkedServer
Apr 19, 2026
Merged

Copy-DbaLinkedServer - Fix issues when migrating to SQL Server 2025#10355
potatoqualitee merged 1 commit intodevelopmentfrom
fix_Copy-DbaLinkedServer

Conversation

@andreasjordan
Copy link
Copy Markdown
Collaborator

Type of Change

  • Bug fix (non-breaking change, fixes Copy-DbaLinkedServer issues copying to SQL 2022 and SQL 2025 #10336 )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (affects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (Invoke-ManualPester)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/dataplat/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Should solve the issue in most situations. We can upgrade the code later if we better test cases.

This can only be testet with SQL Server 2025, so not on AppVeyor.

I use to test in my lab:

$cred = Get-Credential
$target = 'sql04\sql2019'
$source = 'sql03\sql2019'
$destination = 'sql03\sql2025'
$null = New-DbaLogin -SqlInstance $target -Login $cred.UserName -SecurePassword $cred.Password
$null = New-DbaLinkedServer -SqlInstance $source -LinkedServer $target -DataSource tcp:$target -SecurityContext SpecifiedSecurityContext -SecurityContextRemoteUser $cred.UserName -SecurityContextRemoteUserPassword $cred.Password -Provider MSOLEDBSQL
$null = Invoke-DbaQuery -SqlInstance $source -Query "SELECT * FROM [$target].master.sys.databases"
$result = Copy-DbaLinkedServer -Source $source -Destination $destination
$result | Format-Table *
$null = Invoke-DbaQuery -SqlInstance $destination -Query "SELECT * FROM [$target].master.sys.databases"
$null = Remove-DbaLinkedServer -SqlInstance $source -LinkedServer $target -Force -Confirm:$false
$null = Remove-DbaLinkedServer -SqlInstance $destination -LinkedServer $target -Force -Confirm:$false
$null = Remove-DbaLogin -SqlInstance $linkTarget -Login $cred.UserName -Confirm:$false

@potatoqualitee potatoqualitee merged commit d62acf6 into development Apr 19, 2026
13 of 15 checks passed
@potatoqualitee potatoqualitee deleted the fix_Copy-DbaLinkedServer branch April 19, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy-DbaLinkedServer issues copying to SQL 2022 and SQL 2025

2 participants