Skip to content

Commit

Permalink
Update Copy-SqlCentralManagementServer.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubomoy committed Mar 18, 2016
1 parent 7fe5290 commit 0dd0610
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Functions/Copy-SqlCentralManagementServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ PROCESS {
if (!(Test-SqlSa -SqlServer $sourceserver -SqlCredential $SourceSqlCredential)) { throw "Not a sysadmin on $($sourceserver.name). Quitting." }
if (!(Test-SqlSa -SqlServer $destserver -SqlCredential $DestinationSqlCredential)) { throw "Not a sysadmin on $($destserver.name). Quitting." }

if ($sourceserver.versionMajor -lt 10 -or $destserver.versionMajor -lt 10) {
throw "Central Management Server is only supported in SQL Server 2008 and above. Quitting."

}

Write-Output "Connecting to Central Management Servers"
try {
$fromcmstore = New-Object Microsoft.SqlServer.Management.RegisteredServers.RegisteredServersStore($sourceserver.ConnectionContext.SqlConnectionObject)
Expand All @@ -193,4 +198,4 @@ END {
$destserver.ConnectionContext.Disconnect()
If ($Pscmdlet.ShouldProcess("console","Showing finished message")) { Write-Output "Central Management Server migration finished" }
}
}
}

0 comments on commit 0dd0610

Please sign in to comment.