Quantcast
Viewing all articles
Browse latest Browse all 4

Testing a Failover Cluster with Powershell

Just a quick Powershell snippet that I’m going to use to run validation tests on one of my staging Failover Clusters during OOH.

The script below will take some services offline, run the validation tests, before bringing the appropriate cluster groups back online. The report will be saved using the date as the name. To use this you will need to set $cluster appropriately and perhaps customize the cluster groups that are brought offline & online.

?View Code POWERSHELL
Import-Module FailoverClusters;
 
# Set cluster name
$cluster = "Cluster";
 
# Date stamp used for report name
$date = Get-Date -Format "yyyyMMdd";
 
# Take cluster services offline. You may need to customise this
# according to your specific needs
Stop-ClusterGroup -Cluster $cluster -Name "ClusterDtc";
Stop-ClusterGroup -Cluster $cluster -Name "SQL Server (MSSQLSERVER)";
 
# Test Cluster
Test-Cluster -Cluster $cluster -ReportName "$date";
 
# Bring services back online
Start-ClusterGroup -Cluster $cluster -Name "ClusterDtc";
Start-ClusterGroup -Cluster $cluster -Name "SQL Server (MSSQLSERVER)";

The output will look something like below…

Name                       OwnerNode                                      State
----                       ---------                                      -----
ClusterDtc            	   Node1                                 	  Offline
SQL Server (MSSQLSERVER)   Node1                                 	  Offline
WARNING: Cluster Configuration - Validate Resource Status: The test reported
some warnings..
WARNING: Network - Validate IP Configuration: The test reported some warnings..
WARNING:
Test Result:
ClusterConditionallyApproved
Testing has completed successfully. The configuration appears to be suitable
for clustering.  However, you should review the report because it may contain
warnings which you should address to attain the highest availability.
Test report file path: C:\Users\ClusterAdmin\AppData\Local\Temp\20111103.mht
20111103.mht
ClusterDtc            	   Node1                                 	 Online
SQL Server (MSSQLSERVER)   Node1                                 	 Online

Image may be NSFW.
Clik here to view.


Viewing all articles
Browse latest Browse all 4

Trending Articles