Working With Exchange 2007 Clusters
I recently was setting up Exchange 2007 for CCR. During my setup I wanted to verify that all was working and that I could move the Active Node between the two servers I had setup in my cluster. You can’t use the Cluster Admin tools since those are not Exchange aware. Instead you need to utilize PowerShell. That got me thinking that it would be nice to have a script that could transfer the Active Node to the system I executed the script from. Below is the result of my musings.
‘==========================================================================
‘
‘ NAME: MoveCluster.vbs
‘
‘ AUTHOR: Mark D. MacLachlan , The Spider’s Parlor
‘ URL: http://www.thespidersparlor.com
‘ DATE : //2009
‘ COPYRIGHT © 2009, All Rights Reserved
‘
‘ COMMENT:
‘ THIS CODE AND INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF
‘ ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
‘ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
‘ PARTICULAR PURPOSE.
‘
‘ IN NO EVENT SHALL THE SPIDER’S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS
‘ BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
‘ DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
‘ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
‘ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
‘ OF THIS CODE OR INFORMATION.
‘
‘==========================================================================
Set WSHNetwork = CreateObject(”Wscript.Network”)
Set WSHShell = CreateObject(”Wscript.Shell”)
ComputerName = WSHNetwork.ComputerName
Reason = InputBox(”Enter reason for moving cluster active node”)
PSCmd0 = “Start-Sleep 3;Write-Host ‘Adding Exchange Snapin’;add-pssnapin *.Exchange*;”
PSCmd1 = “Start-Sleep 3;Write-Host ‘Getting Cluster Name’;”
PSCmd2 = “$cs = Get-ClusteredMailboxServerStatus|%{$_.Identity}|%{$_.Name};”
PSCmd3 = “Write-Host ‘Cluster:’$cs;Write-Host ‘Moving Cluster Active Node To:’” & ComputerName & “;”
PSCmd4 = “Move-ClusteredMailboxServer -Identity $cs -Target ” & ComputerName & ” -MoveComment ‘” & Reason & “‘ -Confirm:$false;”
PSCMd5 = “Write-Host ‘Getting Cluster Status’;Get-ClusteredMailboxServerStatus”
WSHShell.run “Powershell -noexit -command ” & chr(34) & PSCmd0 & PSCmd1 & PSCmd2 & PSCmd3 & PSCmd4 & PSCmd5
The above also got me thinking that it would be nice to quickly access just the status information of our cluster. That was easy enough since I was already displaying that at the end of the above script.
‘==========================================================================
‘
‘ NAME: CheckCluster.vbs
‘
‘ AUTHOR: Mark D. MacLachlan , The Spider’s Parlor
‘ URL: http://www.thespidersparlor.com
‘ DATE : //2009
‘ COPYRIGHT © 2009, All Rights Reserved
‘
‘ COMMENT:
‘ THIS CODE AND INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF
‘ ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
‘ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
‘ PARTICULAR PURPOSE.
‘
‘ IN NO EVENT SHALL THE SPIDER’S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS
‘ BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
‘ DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
‘ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
‘ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
‘ OF THIS CODE OR INFORMATION.
‘
‘==========================================================================
Set WSHShell = CreateObject(”Wscript.Shell”)
PSCmd0 = “Start-Sleep 3;Write-Host ‘Adding Exchange Snapin’;add-pssnapin *.Exchange*;”
PSCMd1 = “Write-Host ‘Getting Cluster Status’;Get-ClusteredMailboxServerStatus”
WSHShell.run “Powershell -noexit -command ” & chr(34) & PSCmd0 & PSCmd1
No responses yet