Solved

powershell script for moving resource cluster

Posted on 2012-03-11
3
1,000 Views
Last Modified: 2012-03-11
Hello,

I search a powershell script for moving resource cluster in another node.

Thanks

Regards

bibi
0
Comment
Question by:bibi92
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
JoeKlimis earned 500 total points
ID: 37707523
Hi

open powershell window  as administrator on one of the cluster nodes.

type

 import-module failoverclusters

Move-ClusterGroup "YourClusterGroupNamer" -Node OtherNodeName
0
 

Author Comment

by:bibi92
ID: 37707545
Thanks, I know that, but I search a script for automatically failover.
0
 

Author Comment

by:bibi92
ID: 37707567
Import-Module FailoverClusters
 
$clustergroups = Get-ClusterGroup | Where-Object {$_.IsCoreGroup -eq $false}
foreach ($cg in $clustergroups)
{
    $CGName = $cg.Name
    Write-Host "`nWorking on $CGName"
    $CurrentOwner = $cg.OwnerNode.Name
    $POCount = (($cg | Get-ClusterOwnerNode).OwnerNodes).Count
    if ($POCount -eq 0)
    {
        Write-Host "Info: $CGName doesn't have a preferred owner!" -ForegroundColor Magenta
    }
    else
    {
        $PreferredOwner = ($cg | Get-ClusterOwnerNode).Ownernodes[0].Name
        if ($CurrentOwner -ne $PreferredOwner)
        {
            Write-Host "Moving resource to $PreferredOwner, please wait..."
            $cg | Move-ClusterGroup -Node $PreferredOwner
        }
        else
        {
            write-host "Resource is already on preferred owner! ($PreferredOwner)"
        }
    }
}
Write-Host "`n`nFinished. Current distribution: "
Get-ClusterGroup | Where-Object {$_.IsCoreGroup -eq $false}
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now