I will now show you how to use PowerShell cmdlets to create generic application resources. PowerShell is new to Failover Clustering in Windows Server 2008 R2 and will replace Cluster.exe in the next release (more information about WSFC PowerShell). The cmdlets that we need to achieve this are: Get-Cluster and Add-ClusterGenericApplicationRole.
If we are running PowerShell on a machine that is not part of the cluster, we have to retrieve the cluster object first using the Get-Cluster cmdlet.
Once we retrieve the cluster object, the object can then be passed to Add-ClusterGenericApplicationRole cmdlet.
If we are running PowerShell on a clustered node, Get-Cluster cmdlet may be omitted and Add-ClusterGenericApplicationRole can be used directly.
In this case cluster object will be retrieved from the local node (i.e. the node where the command is executing).
Here is an example (Note that A1C1F4X64 is our cluster name):
PS C:\Windows\system32> Get-Cluster A1C1F4X64 | Add-ClusterGenericApplicationRole -CommandLine notepad.exe -Name A1C1F4X64GApp -StaticAddress 172.24.11.96
Report file location: C:\Users\wolfpack\AppData\Local\Temp\tmpA662.tmp.mht
Name OwnerNode State
---- --------- -----
A1C1F4X64GApp a1c1f4x64n2 Online
For additional help, run this PowerShell cmdlet:
Get-Help Add-ClusterGenericApplicationRole
The following command will show you samples:
Get-Help Add-ClusterGenericApplicationRole -examples
For complete information use:
Get-Help Add-ClusterGenericApplicationRole -full
Create a Generic Application Resource Using Cluster.exe
Cluster.exe is another command line tool that can be used to administer a cluster, however Windows Server 2008 R2 is the final release, so it is recommended to use PowerShell to create new scripts and utilities. Cluster.exe will coexist with PowerShell in Windows Server 2008 R2, however you will be able to see that PowerShell significantly simplifies the process.
Below is a sample script that creates and onlines a generic application resource.
REM Store cluster name in a variable
set ClusterName=A1C1F4X64
REM Create a group and online it
cluster %ClusterName% group GenAppGroup /create
cluster %ClusterName% group GenAppGroup /on
REM Create a IP address resource, set required properties, and online it
cluster %ClusterName% res GenAppIP /create /group:GenAppGroup /type:"IP Address"
cluster %ClusterName% res GenAppIP /priv address=172.24.11.96 SubnetMask=255.255.255.0
cluster %ClusterName% res GenAppIP /on
REM Create a network name, set properties, set dependency on the IP resource, and online it
cluster %ClusterName% res GenAppNN /create /group:GenAppGroup /type:"Network name"
cluster %ClusterName% res GenAppNN /priv Name=%ClusterName%-NN
cluster %ClusterName% res GenAppNN /setdep:"[GenAppIP]"
cluster %ClusterName% res GenAppNN /on
REM Create a generic application resource, set the properties, and online it
cluster %ClusterName% res GenAppRes /create /group:GenAppGroup /type:"Generic Application"
cluster %ClusterName% res GenAppRes /prop RestartAction="0"
cluster %ClusterName% res GenAppRes /priv CommandLine=notepad.exe
cluster %ClusterName% res GenAppRes /priv CurrentDirectory=.
cluster %ClusterName% res GenAppRes /on
The script does the following:
1. Creates and onlines a group called GenAppGroup.
2. Creates an IP address resource called GenAppIP in group GenAppGroup. Sets Address and SubnetMask properties of the resource. Brings the IP resource online.
3. Creates a network name resource called GenAppNN. Sets the Name property of the network name resource, sets the dependency of the network name to the IP resource, and brings the network name online.
4. Finally, it creates the generic application resource called GenAppRes, sets the properties, and brings the resource online.
Resources
· Generic Application Resource Type - http://technet.microsoft.com/en-us/library/cc782775.aspx
· Cluster-Unaware applications - http://msdn.microsoft.com/en-us/library/aa369166(VS.85).aspx
· Checklist: Installing a Generic Application resource - http://technet.microsoft.com/en-us/library/cc782179.aspx
· Windows Clustering - http://msdn.microsoft.com/en-us/library/aa373130(VS.85).aspx
In the upcoming weeks I will be adding posts about creating and configuring Generic Services and Generic Scripts.