Skip to content

Commit

Permalink
Merge pull request dataplat#1 from dhrubomoy/detects_sql_version_befo…
Browse files Browse the repository at this point in the history
…re_smo_migration

Update Copy-SqlCentralManagementServer.ps1
  • Loading branch information
dhrubomoy committed Mar 18, 2016
2 parents 7fe5290 + 0dd0610 commit e4a8728
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 e4a8728

Please sign in to comment.