Reputation: 559
I try to switchover a failover cluster. The script below works just fine, but it's running in a loop and takes app. 3 min. When using the FailoverCluster GUI, I'm selecting all services, right mouse click "move" and it runs asynchronously under 1 min. How can it be done with PowerShell?
$clusterGroups = Get-ClusterGroup | where{$_.state -eq "online" -and $_.name -match "SQL Server" }
foreach ($group in $clusterGroups)
{
$currentNode = $group.OwnerNode
Write-Host "Moving $($group.Name) from $($group.OwnerNode) to $targetNode..."
Move-ClusterGroup -Name $group.Name
Write-Host "Successfully moved $($group.Name)"
}
Upvotes: 0
Views: 321