Windows Server Failover Clustering gets boost from PowerShell cmdlets
In Windows Server 2012, there are 81 new and improved failover clustering PowerShell cmdlets. Here's how to make the most of their capabilities.
If you manage Windows Failover Clusters, you may notice the Cluster.exe CLI command is missing after you install the Windows Server 2012 Failover Clustering feature. For years, systems administrators have used Cluster.exe to script the creation of clusters, move failover groups, modify resource properties and troubleshoot cluster outages. Yes, the Cluster.exe command still exists in the Remote Server Administration Tools (RSAT), but it's not installed by default and is considered a thing of the past.
Another thing you may soon notice in Windows Server 2012 is the PowerShell and Server Manager Icons pinned to your taskbar. What you may not notice is that the default installation of the Windows Server 2012 operating system is now Server Core and contains more than 2,300 PowerShell cmdlets. Microsoft is sending a clear message that Windows servers should be managed just like any other data center server, both remotely and through the use of scripting. With Windows, that means PowerShell.
Fortunately, Windows Server Failover Clustering is no stranger to PowerShell. With Windows Server 2008 R2, 69 cluster-related PowerShell cmdlets assist with configuring clusters, groups and resources. This tip explores the new PowerShell cmdlets in Windows Server 2012 failover clusters.
With Windows Server 2012, a total of 81 failover cluster cmdlets can be used to manage components from PowerShell. New cluster cmdlets can perform cluster registry checkpoints for resources (Add-ClusterCheckpoint), monitor virtual machines for events or service failure (Add-ClusterVMMonitoredItem) and configure two new roles: Scale-Out File Servers (Add-ClusterScaleOutFileServerRole) and iSCSI Target Server (Add-ClusteriSCSITargetServerRole).
To list all the failover cluster cmdlets, use the PowerShell cmdlet "Get-command –module FailoverClusters" (Figure 1). I am using the built-in Windows PowerShell Integrated Scripting Environment (ISE) editor, which helps admins get familiar with all the failover clustering cmdlets.
In addition to the FailoverCluster cmdlets, Microsoft has several new modules of PowerShell cmdlets, including ClusterAwareUpdating with 17 new cmdlets, ClusterAware ScheduledTasks with 19 new cmdlets and iSCSITarget with 23 new cmdlets. There are many Cluster Aware Updating cmdlets, such as adding the CAU role (Add-CauClusterRole), getting an update report (Get-CauReport) or invoking a run to scan and install any new updates (Invoke-CauRun).
Cluster-Aware scheduled tasks are new to Windows Server 2012 and the Task Scheduler now integrates with failover clusters. A scheduled task can run in one of three ways:
- ClusterWide on all cluster nodes
- AnyNode on a random node in the cluster
- ResourceSpecific on a node that owns a specific cluster resource
The new ScheduledTasks cmdlets create a cluster-aware scheduled task. In the table, you can see the cmdlets that register, get and set Clustered Scheduled task properties.
|Register-ClusteredScheduledTask||Creates a new clustered scheduled task|
|Unregister-ClusteredScheduledTask||Deletes a clustered scheduled task|
|Set-ClusteredScheduledTask||Updates existing cluster task|
|Get-ClusteredScheduleTask||Enumerates existing clustered tasks|
To get an idea of how to use these PowerShell cmdlets, you first assign an action and trigger variable. The action variable specifies the program that is to be executed, such as the Windows calculator in the example below. The trigger variable sets up when the task is to be executed. The resulting cmdlets to schedule the task to run cluster-wide daily at 14:00 would look like this:
PS C:\> $action = New-ScheduledTaskAction –Execute C:\Windows\System32\Calc.exe
PS C:\> $trigger = New-ScheduledTaskTrigger -At 14:00 –Daily
PS C:\> Register-ClusteredScheduledTask -Action $action -TaskName ClusterWideCalculator -Description "Runs Calculator cluster wide" -TaskType ClusterWide -Trigger $trigger
While only PowerShell can be used to register, get/set and unregister Cluster-Aware scheduled tasks, you can use the Task Scheduler in Computer Management to view the cluster jobs (Figure 2).
Finally, failover clusters can now be configured with a highly available iSCSI Target Server. This role allows you to create and serve iSCSI LUNs in a highly available fashion to clients across your enterprise. To add this new cluster role, use the Cmdlet Install-WindowsFeature –name FS-iSCSITarget-Server (or use Server Manager) to install the iSCSI Target Server role. Then, use the new cmdlet Add-ClusteriSCSITargetServerRole to create the iSCSI Target resource and associate it with shared storage. You can then leverage the new iSCSI Target cmdlets to configure iSCSI LUNs (Figure 3).
There is no shortage of PowerShell cmdlets in Windows Server 2012 to help you manage your failover clusters. In addition to creating, configuring and troubleshooting your cluster, you can use PowerShell cmdlets to add new scale-out file server, iSCSI Target Server roles, clustered scheduled tasks and Cluster-Aware Updating.
About the Author
Bruce Mackenzie-Low is a master consultant at Hewlett-Packard Co., providing third-level worldwide support on Microsoft Windows-based products, including clusters and crash dump analysis. With over 18 years of computing experience at Digital, Compaq and HP, he is a well known resource for resolving highly complex problems involving clusters, SANs, networking and internals. He has taught extensively throughout his career, always leaving his audience energized with his enthusiasm for technology.