Posted by: Andy Grogan | December 15, 2007

Exchange 2007 – Ensuring a clean CCR Node Shutdown…

Exchange 2007 CCR is a wonderful technology which provides many new directions in which an Exchange admin can make their environment more resilient and available – and of course by using it you are no longer tied to the “close proximity” model of cluster nodes which previous versions of Exchange clustering required. However, with every new technology there are compromises which every admin must learn to deal with.

One of the common questions that I have been asked (and I have seen a forum posts about) is how do you safely Shutdown or Reboot a CCR cluster node?

Now there are have been a number of solutions that I have seen and read about – many of which are also linked into the question of “How do I fail a CCR cluster over to the passive node”.

Scott Schnoll wrote an excellent article over on the MSExchange Team’s web-site (located here) which described what are the best tools to use when managing CCR clusters (for example is it safe to use the Cluster manager to fail nodes over in a CCR configuration) – however the upshot of this article was:

If you are using CCR Clustered – the Cluster Administrator Tool and Cluster.exe should not be used to manage the Exchange cluster because:

  • No validation or health checks are made on the passive copy of the database – if you have issues with the passive copy and the fail-over does not complete you are left in a situation where you down-time is longer while you fix the issues with passive node.
  • In certain circumstances using the above tools can leave a database offline because replication is in a broken condition (I have seen this with Public Folders).

In view of the above what are considered the “best practice” when dealing with the situation of moving resources between nodes under CCR? – well that answer to that is to use the Exchange Management Shell move-clusteredMailboxServer cmdlet which does perform such checks – or – if you have installed Exchange 2007 Service Pack1 you can use the “Managed Clustered Mailbox Wizard”.

A very quick run through of the Clustered Mailbox Wizard:

In Service Pack 1 of Exchange 2007 the Exchange team introduced the Clustered Mailbox Wizard into the Exchange Management Console.

It is designed to fill in the gaps that the Cluster Administrator and Cluster.exe tools do not meet, and provide a means where Exchange Admins that might not have gotten to grips with the Exchange management shell commands for Cluster Management can safely manage the cluster.

The following is a quick overview of the CMW in Exchange 2007 SP 1:

Open a connection of a node which is part of your CCR cluster – navigate to [ Start -> Programs -> Microsoft Exchange Server 2007 -> Exchange Management Console ] – when the console loads, expand the “Server Configuration” node and then from the right hand plane Right Click the name of your CCR cluster (see below):

From the context menu that appears select the “Manage Clustered Mailbox Server” option – this will present you with the following dialog box:

You will see that the name of your cluster is preselected and that you are presented with 3 options:

  • Move the clustered mailbox server to another node
  • Start the clustered mailbox server
  • Stop the clustered mailbox server

In this example I will take you through we will be using the “Move the clustered mailbox server to another node” (all of the other examples are very straight forward) – so ensure that the top option is selected and then click on the “Next” button – doing so will change the screen to look like the following:

From the dialog box above click on the button next to the “Target Machine” option and from the box that appears select the node that you wish to move the Exchange resources to, then click on “Ok” – then provide a reason why you would like to move the resources to the new node. When you have filled in the move comment click on the “Next” button which will display a screen which looks like the following:

This is the summary screen of the actions that you wish to take – please review them and when you are happy click on the “Move” button – which will take you to the following screen:

As with many completion screens in the Exchange 2007 you can copy the PowerShell cmdlet used and paste it into Notepad for future reference.

As mentioned before you can use this wizard to perform tasks such as stopping your CCR and Starting your CCR all safe in the knowledge that the correct verification and checks have been made prior to actions being taken.

Right, but what about Shutting down / Rebooting a node?

So, we have very quickly established what to do when you wish to transfer resources to the passive node – but, if the Cluster Administrator and Cluster.exe tools are not aware of Exchange CCR – then what about Windows shutdown or Reboots?

Well the Windows Shutdown processes are also not aware of CCR clustering, and as expected a fail-over will occur when the node is closed down (in some cases this will produce a “lossy” fail-over which can effect Public Folders remounting on the CCR) or rebooted. Consider the following scenario where you are part of a team which has a number of Exchange Admins however some of them are not totally aware of the facts as have been presented above and they decide (as part of some form of routine maintenance) to close down or reboot the primary node using [ Start -> Shutdown -> Shutdown ] – how can you prevent this situation from occurring and mitigate the problems that it might cause?

I have found myself in this situation – as the night shift team where I work does not have a great understanding of clustering and have rudimentary experience in Exchange – however they perform a number of Windows updates per week when required (which can mean either Shutting down or Rebooting the cluster nodes) so I came up with a PowerShell and Group Policy Based Solution where I replace the “Shutdown” button completely on the nodes of my CCR nodes with a new command (Shutdown – CCR Cluster) – see below:

You will notice that the only other command available is “Log off” – we will deal with the configuration of this a little bit later.

From the image above you will see that there is a new option entitled “Shutdown – CCR Cluster” when you click on the options (on either node of the CCR cluster – bearing in mind that this is based around a 2 node CCR cluster) you will be presented with the following screen:

From here you can choose to type “S” to shutdown the node or “R” to reboot the node – for this example I have used “R” for reboot (the entire sequence is the same if you choose “S”. By choosing “R” and pressing <enter> you will be presented with the following screen:

The above screen means that an available node has been found to accommodate the Exchange CCR instance and the script is moving it to the secondary node (actually the script has issued a stop-clusteredMailboxServer and a move-clusteredMailboxServer cmdlet – after performing some WMI analysis)

IF however the secondary node is NOT available or ready to take on the duties of the cluster you will be presented with the following screen:

In this case the node which you have instigated the command from will be either closed down -or– rebooted (depending on the option that was chosen when the Shutdown was selected) – however you can CANCEL the operation by typing in “C”.

If everything is good to go the PowerShell script will stop the clustered mailbox server, then move it to the secondary node and then bring it online.

Then the script will move the Cluster Group over to the Secondary Node and then initiate either a reboot or shutdown of the system (depending on the option that you selected at the beginning of the script.

Ok, I like this how do I implement it?

In order to implement the CCR aware shutdown scripts you will need to create the following Directory on EACH node of your CCR cluster:

C:\PS\

CCR-CLS.ps1 [3KB] – Powershell Batch Script

CCR-Shutdown.bat [1KB] – Windows Batch File

When you have done that download the following two files to the C:\PS\ folder on both your servers.

Open the CCR-CLS.ps1 script using a Text Editor (such as Notepad) – and review the top section – see below;

You will see three values enclosed within a comments section these three values are:

  • $Node1 – Primary Node of the CCR Cluster
  • $Node2 – Secondary Node of the CCR Cluster
  • $Cluster – The network name of the Exchange CCR Cluster

You will see that each of these entries has a “Primary Node Name” or “Secondary Node Name” place holder entry – this must be changed to reflect the names of your cluster nodes and the CCR cluster, for example if my Primary Node was called x64EXCCR1 $Node1 would look like the following:

  • $Node1 = “x64EXCCR1”

You will need to complete these changes to the PS1 script on both cluster nodes.

Now that we have modified the scripts to work with the CCR cluster, we now need to remove the normal “Windows” Shutdown command which I accomplished via Group Policy.

I have posted a video below which takes you thought the steps and indeed the settings that need to be changed in GP, however the following is a summary of changes needed:

  • Create a new OU in Active Directory that will contain the CCR Cluster Nodes for Exchange
  • Move the Cluster Nodes for Exchange into the OU
  • Create a new GPO Object and assign it to the new OU, block inheritance and stipulate “no override”
  • Edit the GPO object so that the following settings take effect:
    • [ Computer Configuration -> Administrative Templates -> System -> Group Policy ] – User Group Policy loopback processing mode set to enabled and “merge
    • [ Computer Configuration -> Administrative Templates -> System -> Group Policy ] – Registry policy processing set to enabled and process even if the GPO objects have not changed
    •  [ User Configuration -> Administrative Templates -> Start Menu and Task Bar ] – Remove and Prevent Access to the Shutdown Command set to Enabled
  • Change the GPO object settings so that they apply to Domain Admins and Enterprise Admins
  • Allow for Domain Replication
  • Run GPUPDATE /force on the server and the log off and on again

Below is a detailed video of the above steps you will need either WinRAR or 7-Zip:

ConfigureGPO.rar [434KB – compressed – 32.4MB expanded]

 When the above is configured and you log back onto one of the nodes you will notice that your start menu will look like the following:

Or if you not using the classic view it will look like the following:

And if you Hit CTRL-ALT-DEL you should notice that the “Shutdown” option is grayed out from the Security Dialog box – see below:

The following video shows how you can add the Powershell CCR aware Shutdown Command to the Start menu, however the following is a summary of the actions that need to be taken on BOTH nodes:

  • Right click on the Start menu and from the context menu that appears choose the “Open – All Users” option
  • Navigate to the C:\PS area and drag a Shortcut to the “CCR-Shutdown.bat” file into the “All Users Start Menu
  • Rename the Shortcut of the batch file in the Start menu to “Shutdown – CCR” and then change its default Icon to that of the Shutdown Command

AddingToStartMenu.rar [287KB – compressed – 12.6MB – expanded]

I hope that you all like the article above, below I have enclosed a view of the source code for the PS Shutdown Script:

# - Change the values below to reflect your CCR Node Names and CCR cluster name
$Node1 = ""
$Node2 = "<Secondary Node Name"
$cluster ="" ""

# - End custom values

$ActionQ = Read-Host "Would you like to (R)eboot or (S)hutdown (type R or S)"
$ActionFinal = $ActionQ.ToLower()

$PResultND1 = Get-WmiObject -Class Win32_PingStatus -Filter "Address='$Node1'"
$PResultND2 = Get-WmiObject -Class Win32_PingStatus -Filter "Address='$Node2'"

if (($PResultND1.StatusCode -eq 0) -and ($PResultND2.StatusCode -eq 0)){
Echo "The Servers are present - checking WMI Services Status..."

$ND1StatusIS = Get-WmiObject -ComputerName $Node1 win32_Service -Filter "Name='MSExchangeIS'"
$ND1StatusSA = Get-WmiObject -ComputerName $Node1 win32_Service -Filter "Name='MSExchangeSA'"

$ND2StatusIS = Get-WmiObject -ComputerName $Node2 win32_Service -Filter "Name='MSExchangeIS'"
$ND2StatusSA = Get-WmiObject -ComputerName $Node2 win32_Service -Filter "Name='MSExchangeSA'"

If ($ND1StatusIS.state -eq "Stopped"){
$ND1CCRPassiveReadyIS = "1"
}else{
$ND1CCRPassiveReadyIS = "0"
}

If ($ND1StatusSA.state -eq "Stopped"){
$ND1CCRPassiveReadySA = "1"
}else{
$ND1CCRPassiveReadySA = "0"
}
If ($ND2StatusIS.state -eq "Stopped"){
$ND2CCRPassiveReadyIS = "1"
}else{
$ND2CCRPassiveReadyIS = "0"
}

If ($ND2StatusSA.state -eq "Stopped"){
$ND2CCRPassiveReadySA = "1"
}else{
$ND2CCRPassiveReadySA = "0"
}

if(($ND1CCRPassiveReadyIS -eq "1") -and ($ND1CCRPassiveReadySA -eq "1")){
Echo "Moving Exchange CCR Resources to the Passive Node..."

Stop-ClusteredMailboxServer -identity $Cluster -StopReason "Node Close Down" -confirm:$false
Move-ClusteredMailboxServer -identity $Cluster -TargetMachine $Node1 -MoveComment "Node close Down" -Confirm:$false
Start-ClusteredMailboxServer -identity $Cluster
Echo "Moving Cluster Resources to the Passive Node..."
Cluster.exe group "Cluster Group" /move:$Node1
Echo "Working on Server Action..."
shutdown.exe /m \\$Node2 /$ActionFinal /t 5
}elseif (($ND2CCRPassiveReadyIS -eq "1") -and ($ND2CCRPassiveReadySA -eq "1")){
Echo "Moving Exchange CCR Resources to the Passive Node..."
Stop-ClusteredMailboxServer -identity $Cluster -StopReason "Node Close Down" -confirm:$false
Move-ClusteredMailboxServer -identity $Cluster -TargetMachine $Node2 -MoveComment "Node close Down" -Confirm:$false
Start-ClusteredMailboxServer -identity $Cluster
Echo "Moving Cluster Resources to the Passive Node..."
Cluster.exe group "Cluster Group" /move:$Node2
Echo "Working on Server Action..."
shutdown.exe /m \\$Node1 /$ActionFinal /t 5
}
}else{
Echo "The Server is not present - No nodes appear to be available to OWN the Exchange Instance."
Echo "Do you wish to close down Exchange on this node and then Shut the computer down? (Y or N)"
$ResponseQ = Read-Host "(Y)es or (N)o"
$ResponseFinal = $ResponseQ.ToLower()

if ($ResponseFinal -eq "y"){

Stop-ClusteredMailboxServer -Identity $Cluster -StopReason "Node Shutdown" -confirm:$false
shutdown.exe /$ActionFinal /t 5

}else{

}

}


Responses

  1. You have a cool blog in here..!

    (I came for something else and saw ya blog in here)

    Take care.!

  2. [...] Exchange 2007 – Ensuring a clean CCR Node Shutdown… [...]

  3. great script. two problems:

    1. the batch file references the wrong name for the ps script file. easy fix.

    2. the command shuts down the opposite node from the one i run it on. i tried switching the names of the node but no joy. any ideas?

    thanks.

  4. Hiya Troy – I have sent you a mail.

    1) Thanks for pointing out the goof in the batch file – I will sort this out pronto!

    2) Can you send me a copy of your script as you have configured it – it worked in my test lab prior to posting, but I would be interested to see if I missed something. – cheers

    A

  5. I’ve been drilling down into the procedure for shutting down and rebooting a node of a CCR Cluster and wondered if I could trouble you for the rational for the inclusion of the stop-ClusteredMailBoxServer command in your procedure. My take from reading documents on installing updates and managing this type of exchange cluster is that by using the move-ClusteredMailboxServer command that all the needed checks are done and then by using the cluster.exe /move the Cluster Group would be moved to the passive node enabling an admin to install patches/reboot and otherwise manage the now passive node without having to go through the shutdown step… I’m sure I’m missing something… thanks in advance – Chris

  6. Hiya Chris, you are totally correct normally a simple move-clusteredMailbxServer would suffice – but for some reason I found on my test lab every now and then when issuing the command some of the stores would not mount on the other node (without Manual intervention). I found by issuing a stop then move this situation did not occur. I do not believe that is causes any major issues by issing the stop first.
    Cheers

  7. 2. the command shuts down the opposite node from the one i run it on. i tried switching the names of the node but no joy. any ideas?

    did you ever find a resolution for this? I copied the file from the site and only changed the server names as specified

  8. I corrected some of the node issues and added a few tweaks.

    # – Change the values below to reflect your CCR Node Names and CCR cluster name

    $Node1 = “MLW-CCRNode1″
    $Node2 = “MLW-CCRNode2″
    $Cluster = “MailboxServer”

    # – End custom values

    cls
    Echo ” ”
    Echo “Which host would you like to shutdown?”
    Echo ” 1) $node1″
    Echo ” 2) $node2″
    Echo ” ”
    $shutdownHost = Read-host “Please type 1 or 2″

    if ($shutdownHost -eq “2″) {
    $temp = $node1
    $node1 = $node2
    $node2 = $temp
    }else{
    if ($ShutdownHost -ne “1″) {
    cls
    echo “$ShutdownHost is an invalid selection, please run the script again”
    exit
    }}

    CLS
    Echo ” ”
    $ActionQ = Read-Host “Would you like to (R)eboot or (S)hutdown $Node1(type R or S)”
    $ActionFinal = $ActionQ.ToLower()

    $PResultND1 = Get-WmiObject -Class Win32_PingStatus -Filter “Address=’$Node1′”
    $PResultND2 = Get-WmiObject -Class Win32_PingStatus -Filter “Address=’$Node2′”

    if (($PResultND1.StatusCode -eq 0) -and ($PResultND2.StatusCode -eq 0)){
    Echo ” ”
    Echo ” ”
    Echo “The Servers are present – checking Exchange Services Status…”

    $Node1StatusIS = Get-WmiObject -ComputerName $Node1 win32_Service -Filter “Name=’MSExchangeIS’”
    $Node1StatusSA = Get-WmiObject -ComputerName $Node1 win32_Service -Filter “Name=’MSExchangeSA’”

    $Node1StateIS = $Node1StatusIS.state
    $Node1StateSA = $Node1StatusSA.state

    Echo ” ”
    Echo “The Exchange Information Store service on $Node1 is $Node1StateIS”
    Echo “The Exchange System Attendant service on $Node1 is $Node1StateSA”

    if(($Node1StatusIS.state -eq “Running”) -and ($Node1StatusSA.state -eq “Running”)){
    Echo ” ”
    Echo “Moving Exchange CCR Resources to the Passive Node…”
    Echo ” ”
    Move-ClusteredMailboxServer -identity $Cluster -TargetMachine $Node2 -MoveComment “Node close Down” -Confirm:$false
    }
    Echo ” ”
    Echo “Moving Windows Cluster Resources to the Passive Node…”
    Cluster.exe group “Cluster Group” /move:$Node2
    Cluster.exe group “Available Storage” /move:$Node2
    Echo ” ”
    Echo ” ”
    Cluster Group
    Echo ” ”
    Echo ” ”
    Echo “Performing Shutdown or Reboot.”
    shutdown.exe /m \\$Node1 /$ActionFinal /t 5

    }else{
    Echo “One of the cluster nodes is not responding. The Exchange cluster Services can not be moved.”
    Echo “Do you wish to close down Exchange on this node and then Shutdown the computer? (Y or N)”
    $ResponseQ = Read-Host “(Y)es or (N)o”
    $ResponseFinal = $ResponseQ.ToLower()

    if ($ResponseFinal -eq “y”){

    Stop-ClusteredMailboxServer -Identity $Cluster -StopReason “Node Shutdown” -confirm:$false
    shutdown.exe /$ActionFinal /t 5

    }else{
    Echo ” ”
    Echo “WARNING: The cluster could not be shutdown at this time.”

    }

    }
    $null = read-host “press Enter to close screen”
    cls

  9. Sorry about the smileys. The editor changed the ending ) for some reason.

  10. [...] In this article I would like to present an example  script which is a little similar to the CCR Shutdown Script which I wrote about in this post: http://telnetport25.wordpress.com/2007/12/15/exchange-2007-ensuring-a-clean-ccr-node-shutdown/ [...]

  11. Does your shutdown script work on Windows 2008 CCR Exchange 2007 SP1 ?

  12. Hiya Peter,

    Yes the script should indeed work under that configuration – however I would also advise that you have a look the following http://telnetport25.wordpress.com/2008/07/29/powershell-and-moving-ccr-mailbox-server-instances-powershell-script/

    Which although is not specifically a Shutdown script – could easily be converted to one.

    Cheers

    A

  13. Hi,
    seems that the first version was always shutting down the Active Node, while the second (pasted to the comment post) does not shutdown any… I got an error message:
    Get-WmiObject : Invalid query
    At C:\ps\ccr-cls.ps1:33 char:28
    + $PResultND1 = Get-WmiObject <<<< -Class Win32_PingStatus -Filter “Address=’$Node1′”
    Get-WmiObject : Invalid query
    At C:\ps\ccr-cls.ps1:34 char:28
    + $PResultND2 = Get-WmiObject <<<< -Class Win32_PingStatus -Filter “Address=’$Node2′”

  14. Regarding the above post. Seems that it was an issue with quotes. the filter parameter should look like -Filter “”"Address=’$Node1′”"”

    Thanks, Marcin

  15. The original script seems to work fine for my primary node but the passive node simply shutsdown /reboots the primary node as well. Is there something im doing wrong?

  16. These scripts are quite new to me.
    I need a script to move clusteredmailboxserver with out any inputs.

    because I want to schedul the scripts using scheduled taks for off houser.

    Could somebody please post a script,

    -Manju

  17. Formatting may be a little messed up, but this will do a move of the cluster with no intervention and can be run on either of the CCR nodes of the cluster

    # ****************************************************
    # Exchange 2007 Move CCR Cluster Server Script
    # Version 1.0
    # Author:
    #
    # Original Source: Andy Grogan (http://telnetport25.wordpress.com)
    #
    #
    # Purpose:
    #
    # This script is designed to provide a safe method of
    # moving the Exchange CCR cluster between two Nodes.
    #
    # This script does not require any user intervention
    # it will detect which Node is Active and Which is
    # Passive and also determine Quorum Owner and move if
    # necessary
    #
    # ****************************************************

    # Get the local node NETBIOS name

    $CompStat = Get-WmiObject win32_computersystem
    $Localhst = $CompStat.Name

    # Define the move CCR clustered instance logic as a function (accepts two parameters Cluster Name and Target Node)

    Function do_MoveCCRCluster($ClusterName, $TargetNodeInstance){

    # Stop-ClusteredMailboxServer -Identity $ClusterName -StopReason “Script Based ShutDown” -Confirm:$false
    Write-Host “”
    Write-Host “Moving Exchange CCR Resources to:” $TargetNodeInstance
    Move-ClusteredMailboxServer -Identity $ClusterName -MoveComment “Script Based Move” -TargetMachine $TargetNodeInstance -Confirm:$False
    # Start-ClusteredMailboxServer -Identity $ClusterName

    }

    # Define the move Microsoft Cluster instance logic as a function (accepts two parameters Cluster Name and Target Node)

    Function do_MoveMicrosoftCluster($ClusterName, $TargetNodeInstance){

    Write-Host “”
    Write-Host “Moving Windows Cluster Resources to:” $TargetNodeInstance
    Cluster.exe group “Cluster Group” /move:$TargetNodeInstance
    }

    # Define a global warning function

    Function do_Warning(){

    Write-Host “”
    Write-Warning “Proceeding with this script will render your Exchange Server offline for a period of time, this means that all Mailboxes stored on this server will be unavailable.”
    Write-Host “”
    }

    # Define a global warning for Cluster Move failure function

    Function do_ClusterMoveWarning($ClusterName){

    Write-Host “”
    Cluster Group
    Get-ClusteredMailboxServerStatus -Identity $ClusterName
    Write-Warning “Cluster Failover unsuccessful!”
    Write-Host “”
    }

    Function do_ClusterMoveSuccess($ClusterName){

    Write-Host “”
    Cluster Group
    Get-ClusteredMailboxServerStatus -Identity $ClusterName
    Write-Host “Cluster Failover Successful”
    Write-Host “”
    }

    # Determine the Cluster that the node is a member of using the Get-MailboxServer cmdlet

    $Seed = Get-MailboxServer | Where-Object { $_.RedundantMachines -eq $Localhst }
    Write-Host “The Cluster which this server is a member of is:” $Seed.Name
    Write-Host “The Current Node that you are logged onto is:” $Localhst

    # Determine if the local machine is the active node in the cluster and also work out if the node has the Quroum

    $Machine = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}
    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    # If the commands above return a NULL then the local node is NOT the active node in the cluster

    If ($Machine -eq $NULL -and $MachineQ -eq $NULL){

    Write-Host “This machine is NOT the Active Node”

    # Get all the node which make up the cluster stick them in an array

    $Act = Get-MailboxServer -Identity $Seed.Name | Select RedundantMachines

    # The following determines which host you are logged into within the cluster.
    # Based upon that informtion it determines which node is available to take over clustering
    # duties. For example if the current hostname is not the name of the first redundant machine
    # in the $Act array and also does not currently have the cluster this node can be the target node

    If ($Act.RedundantMachines[0] -ne $localhst){
    Write-Host “The Active Node is: ” $Act.RedundantMachines[0]
    Write-Host “The Passive Node is: ” $Act.RedundantMachines[1]
    do_Warning
    $Choice = Read-Host “Do you wish to move the Clustered Exchange instance to”$Act.RedundantMachines[1]“? [Y:Yes | N:No]”

    If ($Choice.ToLower() -eq “y”){

    do_MoveCCRCluster $Seed.Name $Act.RedundantMachines[1]

    $Machine = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}
    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($Machine -eq $NULL -and $MachineQ -eq $NULL){

    do_ClusterMoveWarning $Seed.Name

    }else{

    do_MoveMicrosoftCluster $Seed.Name $Act.RedundantMachines[1]

    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($MachineQ -eq $NULL){

    do_ClusterMoveWarning $Seed.Name
    }else{
    do_ClusterMoveSuccess $Seed.Name
    }

    }

    }
    }else{
    # If the second machine in the ARRAY is the local host ask to
    Write-Host “The Active Node is: ” $Act.RedundantMachines[1]
    Write-Host “The Passive Node is: ” $Act.RedundantMachines[0]
    do_Warning
    $Choice = Read-Host “Do you wish to move the Clustered Exchange instance to”$Act.RedundantMachines[0]“? [Y:Yes | N:No]”
    If ($Choice.ToLower() -eq “y”){

    do_MoveCCRCluster $Seed.Name $Act.RedundantMachines[0]

    $Machine = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}
    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($Machine -eq $NULL -and $MachineQ -eq $NULL){

    do_ClusterMoveWarning $Seed.Name

    }else{

    do_MoveMicrosoftCluster $Seed.Name $Act.RedundantMachines[0]

    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($MachineQ -eq $NULL){

    do_ClusterMoveWarning $Seed.Name
    }else{
    do_ClusterMoveSuccess $Seed.Name
    }

    }

    }

    }
    }else{

    # If the Host IS the currently active host – give the option to move the other node

    $Act = Get-MailboxServer -Identity $Seed.Name | Select RedundantMachines
    Write-Host “This machine IS the Active Node”

    If ($Act.RedundantMachines[1] -ne $localhst){
    Write-Host “The Active Node is: ” $Act.RedundantMachines[0]
    Write-Host “The Passive Node is: ” $Act.RedundantMachines[1]
    do_Warning
    $Choice = Read-Host “Do you wish to move the Clustered Exchange instance to”$Act.RedundantMachines[1]“? [Y:Yes | N:No]”
    If ($Choice.ToLower() -eq “y”){

    do_MoveCCRCluster $Seed.Name $Act.RedundantMachines[1]

    $Machine = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}
    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($Machine -eq $NULL -and $MachineQ -eq $NULL){

    do_MoveMicrosoftCluster $Seed.Name $Act.RedundantMachines[1]

    $MachineQO = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($MachineQO -eq $NULL){

    do_ClusterMoveSuccess $Seed.Name
    }else{
    do_ClusterMoveWarning $Seed.Name
    }

    }else{

    do_ClusterMoveWarning $Seed.Name

    }

    }
    }else{
    Write-Host “The Active Node is: ” $Act.RedundantMachines[1]
    Write-Host “The Passive Node is: ” $Act.RedundantMachines[0]
    do_Warning
    $Choice = Read-Host “Do you wish to move the Clustered Exchange instance to”$Act.RedundantMachines[0]“? [Y:Yes | N:No]”
    If ($Choice.ToLower() -eq “y”){

    do_MoveCCRCluster $Seed.Name $Act.RedundantMachines[0]

    $Machine = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}
    $MachineQ = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($Machine -eq $NULL -and $MachineQ -eq $NULL){

    do_MoveMicrosoftCluster $Seed.Name $Act.RedundantMachines[0]

    $MachineQO = Get-ClusteredMailboxServerStatus -identity $Seed.Name | Select OperationalMachines | Where-Object {$_.OperationalMachines -eq “$Localhst “}

    If ($MachineQO -eq $NULL){

    do_ClusterMoveSuccess $Seed.Name
    }else{
    do_ClusterMoveWarning $Seed.Name
    }

    }else{

    do_ClusterMoveWarning $Seed.Name

    }

    }
    }
    }

  18. Sorry, there is one prompt in the previous script which is just a confirmation that you are sure you want to move the cluster resources. So that prompt and y/n check needs to be removed and it will work without any input.

  19. I also have a reboot script and an autoreboot script (no prompt) for a CCR cluster based off of the move script above if anyone is interested I will post them…oh and a move File Share Witness location batch file…

    • I would love a move File Share Witness location batch file, if you got one.

  20. Scott,
    I tried the script above from a passive CCR node. It moved the Quorum ownership to the passive node but it fails when moving the the Exchange cluster.

    Is it possible to combine the move cluster functionality and shutdown into one script?

  21. De downloadlinks are dead …..

  22. Christmas 2009 is bordering on upon us, the clocks are back, the nights are subfuscous and Haloween is a few days away. . If you insufficiency to secure a less stressfull pro tem this Christmas then I propose you begin to assume at this very moment. If you start buying presents seldom you will be qualified to spread the cost of your gift giving across not too months.

    http://presentsforher.blogue.fr/?p=6

  23. Great article!! I’d like to know if there’s anything I should take care of when I’m shutting down the passive node for maintenance.

    What happens with replication? Should I suspend it first?

  24. [...] 2009 | Autor: Christian Scholz  Post verschicken  Post drucken Auf der Seite http://telnetport25.wordpress.com/2007/12/15/exchange-2007-ensuring-a-clean-ccr-node-shutdown/ ist ein Script verlinkt, dass einen sauberen shutdown eines Exchang Cluster Knotes [...]


Leave a response

Your response:

Categories