search
top

Windows 2008 R2 Cluster Report with PowerShell

You know how it is, manager love reports and really we geeks like some reports as well. Recently I was tasked to generate a health check report for some of the Windows 2008 R2 Active / Passive clusters using PowerShell.

With Windows 2008 R2 cluster Microsoft has provided FailoverClusters modules as well as the deprecated cluster command. There is no per say report to check for a status on clusters. Using the Failover Cluster PowerShell modules it is possible to create a report. There is a good reference for the cluster modules here .

For this post I was able to create a scheduled PowerShell script to gather Cluster VIP, Quorum, node status, groups, resources and resource dependencies and put in a formatted text file and emailed.

This can be done using Get-Cluster, Get-ClusterQuorum, Get-ClusterNode, Get-ClusterGroup, Get-ClusterResource and Get-ClusterResourceDependency cmdlets from FailoverCluster PowerShell module.

The Report is populated using Add-Content and Out-File and setting the encoding to ASCII and finally using Format-Table to make it look nice. Also, the inclusion of $LogFileName variable to call out the filename in one place and reference the variable. The script is pretty easy to figure out how it works and doesn’t need much explanation, so here it is in all it’s glory.

Hope this is of to you as it is for me and getting a daily report of what is online and offline. Look for future posts for how to take this report and use the output to create monitors using PowerShell. I have attached the script cluster_ps.ps1, just rename from txt to ps1.

2 Responses to “Windows 2008 R2 Cluster Report with PowerShell”

  1. Joe says:

    I set $logpath on all lines with the log file referenced and set $logpath = ‘c:\somepath’ at front of script.

    Also added:

    # Get resource parameters
    Add-Content $logpath\clustercheck.txt “`nListing Cluster Resource Parameters” -Encoding ASCII
    Get-ClusterGroup | Get-ClusterResource | Get-ClusterParameter | Format-Table -AutoSize -Wrap | Out-File -append -Encoding ASCII $logpath\clustercheck.txt

    afterall, if you are trying to learn all there is to learn about resource, wouldn’t you want all of its details?

    • newlife007 says:

      Those are great to have and always the more info the better. For my use I didn’t want all the info because I was also targeting an HTML formatted report and the extra data was unreadable. The get-cluster power shell cmdlets provide alot of info.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top