次の方法で共有


How to use Powershell in Failover Clustering–Part 1

Powershell is a really powerful toy for any Windows administrator where tasks need to be automated and or repeated several times.

Here I would like to start an blog series of how to use Powershell in Windows Server Failover Cluster (WSFC) environments.

Let’s start over with some basic commandlet’s to get status of clustered groups, resources and cluster core resources, move groups and soon. Later we will do some advanced operations with Powershell.

The WSFC Powershell (CLI) interface is everywhere available where WSFC feature is installed:

  • Windows Server 2008 R2 (SP1)
    • Full
    • Core (not installed by default)
  • Microsoft Hyper-V Server 2008 R2 (SP1)
  • Remote Server Administration Tools (RSAT) for Windows 7 (SP1)

First of all, you must import the “FailoverCluster” module to get the commandlet’s. To get a list of all available modules you can use:

PS:\ Get-Module -ListAvailable

image

To import the module you need to use “Import-Module” commandlet:

PS:\ Import-Module FailoverClusters

image

YUHUU Smile We have now the full set of all Failover Cluster commandlet’s available, let’s have a look which they are:

PS:\ Get-Command –Module FailoverClusters or Get-Command | findstr Cluster

image

image

As you can see, there are for the most of the GUI actions an cmdlet available, sometimes more. In total there are 69 Failover Cluster specific cmdlet’s which gives you many many *creative* usage ways.

NOTE: A really helpful method with Powershell is the Get-Help cmdlet:
Built-in help:
Get-Help cmdlet -Full Examples:
Get-Help cmdlet –Examples Online help (INET connection is required):
Get-Help cmdlet –Online

Let’s start with some easy commandlet to do some basic operations:

How to get a list of all clustered groups via Powershell?

PS:\ Get-ClusterGroup

image

image

As you can see I do have some resources offline. Let’s bring them online

How to bring online a Cluster Group via Powershell?

PS:\ Start-ClusterGroup “GROUPNAME” image

Now, let’s move a group to a different node to balance the workloads in my *test* cluster Smile

How to move a cluster group via Powershell?

PS:\ Move-ClusterGroup “GROUPNAME” –Node “NODENAME”

image

How to get a list of all clustered resources via Powershell?

PS:\ Get-ClusterResource

image

How to get a list of all clustered groups from an node via Powershell?

PS:\ Get-ClusterNode –Name “NODENAME” | Get-ClusterGroup

image

How to get a list of all clustered resources within a cluster group via Powershell?

PS:\ Get-ClusterGroup "GROUPNAME" | Get-ClusterResource

image

How to get more parameters from a clustered disk (resource)?

PS:\ Get-ClusterResource "Cluster Disk 1" | Get-ClusterParameter

image

image

How can I test/validate my cluster via Powershell?

Since R2 you can also validate your cluster via CLI Powershell:

PS:\ Get-Help Test-Cluster

A.e.: PS:\ Test-Cluster –Node Node1,Node2

image

image

A list of all available Test-Cluster scenarios - which can be *in-/excluded*- can you find here:

image

Hope this has opened your interest in more around Powershell for Failover Clustering - stay tuned for more or start with playing with PS…..Winking smile

Some additional reference can you find here:

Mapping Cluster.exe Commands to Windows PowerShell Cmdlets for Failover Clusters
https://technet.microsoft.com/en-us/library/ee619744(WS.10).aspx

PowerShell Quick Reference
https://www.microsoft.com/downloads/details.aspx?FamilyId=DF8ED469-9007-401C-85E7-46649A32D0E0&displaylang=en

Clustering with PowerShell
https://technet.microsoft.com/en-us/library/ee619751(WS.10).aspx

PowerShell for Failover Clustering: Finding the Drive Letter
https://blogs.msdn.com/b/clustering/archive/2009/10/16/9908325.aspx

PowerShell for Failover Clustering: Understanding Error Codes
https://blogs.msdn.com/b/clustering/archive/2010/04/28/10003627.aspx

PowerShell for Failover Clustering: Frequently Asked Questions
https://blogs.msdn.com/b/clustering/archive/2009/05/23/9636665.aspx

Regards

Ramazan Can

Comments

  • Anonymous
    October 28, 2011
    I had no idea how effective a smaller server core is at reducing security breaches. Something I’ve got to keep in mind in the future.
  • Anonymous
    September 17, 2012
    Hi Ramazan,We have 2nodes windows 2008R2 cluster,where SQL & SAP database is running, last 3 months we are facing very poor performance.sometimes windows cluster is going hangs,we have already logged the call with Microsoft,but we have not getting any solution, your help will be appreciate..
    • Anonymous
      September 17, 2012
      Hi Shan,Generally performance issues to analyze are really hard in a forum as there is a broad range of involved areas where a bottleneck can sit :) especially in SQL areas where I/O plays a key role I would generally start looking on disk que lengths, just to make sure before digging deeper into root cause analyses.... ;)Let me know if you have any further question on thisRamazan Can
  • Anonymous
    January 30, 2013
    I am unable to load the failover cluster module on my Win 7 machine because it isn't listed. I've installed RSAT SP1 and have enabled the Failover Clustering Tools feature. I can see/access the Failover Cluster Manager gui in my admin tools folder. I have the x64 version of Win 7 installed on my system. I disabled and re-enabled the Failover Clustering Tools feature and I still can't see the FailOver module when I run Get-Module -ListAvailable. It just isn't there.What am I missing?
    • Anonymous
      March 18, 2013
      The comment has been removed