Techibee.com

PowerShell: Get Windows Cluster instances status

Using powershell, we can query the status of a given windows cluster and instances inside it. With Windows 2008, MS is offering this ability. You need to import the failoverclusters  module to use the cmdlets available to manage windows cluster.

Import cluster module:

Import-module failoverclusters

Using this module you can do variety of things in cluster like adding and deleting disk, adding and deleting network interfaces, adding and deleting any other cluster resources, what not, you can do majority of operations with this powershell module.

Now I will give you a little example about how to connect to a cluster and get instances hosted on it.

Get-Cluster -Name cluster1.domain.com | Get-ClusterGroup

The above will connect to cluster1.domain.com and returns the status of groups/instances hosted on this cluster. You can also see preferred nodes, fail-over, fail-back settings for a given group, etc. I will try to post about them when I get a changes.

For your quick reference, I am posting the cluster cmdlets (source: technet)

Add-ClusterDisk Make a new disk available for use in a failover cluster. The disk (LUN) must be exposed to all nodes in the failover cluster, and should not be exposed to any other servers.
Add-ClusterFileServerRole Create a clustered file server (resource group that includes one or more disks, on which you can create shared folders for users).
Add-ClusterGenericApplicationRole Configure high availability for an application that was not originally designed to run in a failover cluster.
Add-ClusterGenericScriptRole Configure an application controlled by a script that runs in Windows Script Host, within a failover cluster.
Add-ClusterGenericServiceRole Configure high availability for a service that was not originally designed to run in a failover cluster.
Add-ClusterGroup Add an empty resource group to the failover cluster configuration, in preparation for adding clustered resources to the group.
Add-ClusterNode Add a node (server) to a failover cluster. Before adding the new node, you should run validation tests on the existing nodes together with the proposed new node.
Add-ClusterPrintServerRole Create a clustered print server (a resource group that includes a printer and a disk for storing print job information and printer drivers).
Add-ClusterResource Add a resource to a clustered service or application (resource group) in a failover cluster.
Add-ClusterResourceDependency Add a resource to the list of resources that a particular resource depends on (using AND as the connector) within a failover cluster. Existing dependencies will remain in the list.
Add-ClusterResourceType Add a resource type to a failover cluster, and specify information such as the dynamic-link library (DLL) to use with that resource type.
Add-ClusterServerRole Add a group containing only a client access point and storage to the failover cluster configuration.
Add-ClusterSharedVolume Make a volume available in Cluster Shared Volumes in a failover cluster.
Add-ClusterVirtualMachineRole Create a clustered virtual machine, that is, a virtual machine that can be failed over if necessary to a different server in the failover cluster.
Block-ClusterAccess Prevent the specified user or users from accessing a failover cluster.
Clear-ClusterDiskReservation Clear the persistent reservation on a disk in a failover cluster.
Clear-ClusterNode Clear the cluster configuration from a node that was evicted from a failover cluster.
Get-Cluster Get information about one or more failover clusters in a given domain.
Get-ClusterAccess Get information about permissions that control access to a failover cluster.
Get-ClusterAvailableDisk Get information about the disks that can support failover clustering and are visible to all nodes, but are not yet part of the set of clustered disks.
Get-ClusterGroup Get information about one or more clustered services or applications (resource groups) in a failover cluster.
Get-ClusterLog Create a log file for all nodes (or a specific node) in a failover cluster.
Get-ClusterNetwork Get information about one or more networks in a failover cluster.
Get-ClusterNetworkInterface Get information about one or more network adapters in a failover cluster.
Get-ClusterNode Get information about one or more nodes (servers) in a failover cluster.
Get-ClusterOwnerNode For a resource in a failover cluster, get information about which nodes can own the resource. For a clustered service or application (a resource group), get information about the order of preference among owner nodes.
Get-ClusterParameter Get detailed information about an object in a failover cluster, such as a cluster resource. This cmdlet is used to manage private properties for a cluster object.
Get-ClusterQuorum Get information about the quorum configuration of a failover cluster.
Get-ClusterResource Get information about one or more resources in a failover cluster.
Get-ClusterResourceDependency Get information about the dependencies that have been configured between clustered resources in a failover cluster.
Get-ClusterResourceDependencyReport Generate a report that lists the dependencies between resources in a failover cluster.
Get-ClusterResourceType Get information about one or more resource types in a failover cluster.
Get-ClusterSharedVolume Get information about Cluster Shared Volumes in a failover cluster.
Grant-ClusterAccess Grant access to a failover cluster, either full access or read-only access.
Move-ClusterGroup Move a clustered service or application (a resource group) from one node to another in a failover cluster.
Move-ClusterResource Move a clustered resource from one clustered service or application to another within a failover cluster.
Move-ClusterSharedVolume Move a Cluster Shared Volume to ownership by a different node in a failover cluster.
Move-ClusterVirtualMachineRole Move the ownership of a clustered virtual machine to a different node.
New-Cluster Create a new failover cluster. Before you can create a cluster, you must connect the hardware (servers, networks, and storage), and run the validation tests.
Remove-Cluster Destroy an existing failover cluster. The affected servers will no longer function together as a cluster.
Remove-ClusterAccess Remove a user from the access list on the cluster.
Remove-ClusterGroup Remove a clustered service or application (also called a resource group) from a failover cluster.
Remove-ClusterNode Remove a node from a failover cluster. After the node is removed, it no longer functions as part of the cluster unless you add it back to the cluster.
Remove-ClusterResource Remove a clustered resource from the failover cluster.
Remove-ClusterResourceDependency Remove a dependency between two resources in a clustered service or application within a failover cluster.
Remove-ClusterResourceType Remove a resource type from a failover cluster.
Remove-ClusterSharedVolume Remove a volume from the Cluster Shared Volumes in a failover cluster, and place it in Available Storage in the cluster.
Repair-ClusterSharedVolume Run repair tools on a Cluster Shared Volume locally on a cluster node.
Resume-ClusterNode Resume activity on a failover cluster node after you have suspended it (that is, paused it).
Resume-ClusterResource Turn off maintenance for a disk resource or Cluster Shared Volume within a failover cluster.
Set-ClusterLog Set the size and level of detail for the cluster log.
Set-ClusterOwnerNode For a resource in a failover cluster, specify which nodes can own the resource. For a clustered service or application (a resource group), specify information about the order of preference among owner nodes.
Set-ClusterParameter Control specific properties of an object in a failover cluster, such as a resource, a group, or a network.
Set-ClusterQuorum Configure quorum options for a failover cluster.
Set-ClusterResourceDependency Specify the resources that a particular resource depends on within a failover cluster. Existing dependencies will be overwritten by the dependencies that you specify.
Start-Cluster Start the Cluster service on all nodes of the cluster on which it is not yet started.
Start-ClusterGroup Bring one or more clustered services and applications (also known as resource groups) online on a failover cluster.
Start-ClusterNode Start the Cluster service on a node in a failover cluster.
Start-ClusterResource Bring a resource online in a failover cluster.
Stop-Cluster Stop the Cluster service on all nodes in a failover cluster, which will stop all services and applications configured in the cluster.
Stop-ClusterGroup Take one or more clustered services and applications (also known as resource groups) offline on a failover cluster.
Stop-ClusterNode Stop the Cluster service on a node in a failover cluster.
Stop-ClusterResource Take a resource offline in a failover cluster.
Suspend-ClusterNode Suspend activity on a failover cluster node, that is, pause the node.
Suspend-ClusterResource Turn on maintenance for a disk resource or Cluster Shared Volume so that you can run a disk maintenance tool without triggering failover.
Test-Cluster Run validation tests for failover cluster hardware and settings. Tests can be run both before and after a cluster is set up.
Test-ClusterResourceFailure Simulate a failure of a cluster resource.
Update-ClusterIPResource Renew or release the DHCP lease for an IP address resource in a failover cluster.
Update-ClusterVirtualMachineConfiguration Refresh the configuration of a clustered virtual machine within a failover cluster.
Exit mobile version