Recently I was checking a Windows Failover Cluster (WFC) node and noticed it had a very high uptime. Seeing this I wanted to check the uptime of the other nodes too. Given that this cluster has 9 nodes I decided to try and do this via PowerShell and make the script re-usable to be able to check other nodes in different clusters.

Below is the script I came up with after some reading online.

For PowerShell beginners, I am using Read-Host to allow the user to input the cluster name, foreach loop to get the nodes making part of the cluster and created a custom PowerShell object to store the details which will then allow it to provide a tabled output.

#Request Cluster Name
$clustername = Read-Host "Type Cluster FQDN"
#Initiliaze uptime variable

#Get nodes in the cluster
$clusternodes=Get-ClusterNode -Cluster $clustername

#Foreach loop to go through each node in the cluster and extract the required uptime information
foreach($Node in $
#Calculate uptime of the node
$nodeuptime=(get-date) - (gcim Win32_OperatingSystem -ComputerName $Node).LastBootUpTime | select Days, Hours, Minutes
#Custom PowerShell object to store the name and uptime information of the node
$nodeinfo= [PSCustomObject]@{
Name = $Node
Days = $nodeuptime.Days
Hours = $nodeuptime.Hours
Minutes = $nodeuptime.Minutes
#Append node information
$uptime += $nodeinfo
#Show results
$uptime | ft

When running the script, you will be requested for the cluster FQDN you would like to check the uptime of the nodes. Once done the script will issue and output similar to the below:

Type Cluster FQDN: cluster.domain.local

Name  Days Hours Minutes
----  ---- ----- -------
Node1  212    22      26
Node2  746    20       5
Node3  614    20      26
Node4  768    19      15
Node5  614    14      33
Node6  616     2       2
Node7  770     1      46
Node8  616     2      47
Node9  740    21      22

As you can see the uptime is very high but that will be taken care of 🙂

Hope you found it useful. Let us know in the comments.

By Brian Farrugia

I am the author of More info can be found on the about page.

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.