Creating and Configuring a Generic Script Resource

Published Mar 15 2019 01:49 PM 5,778 Views
First published on MSDN on Sep 28, 2009


In recent posts I discussed how to create and configure Generic Applications and Generic Services .  In this post I will talk about creating the third of our generic containers, Generic Scripts.

What is Generic Script Resource Type?

The Generic Script resource type allows us to achieve high availability for applications that can be controlled through scriptable interfaces. If you have an application that can be started, stopped, and monitored through a script, you can run the application as a scripted resource.  Note that you have to implement the Generic Script resource DLL entry points in the script file.  A scripted resource is an instance of the Generic Script resource type under the control of a script.  The scripts run in the Windows Scripting Host.

The Generic Script resource DLL implements a Resource Object for each instance of a generic script resource. Resource Objects have methods and properties that your script can use to accomplish several tasks such as identifying the resource, logging information about the resource, and manipulating private properties of the resource.  For more information about the resource object, visit .

How to Create/Configure a Generic Script Resource

In this section, we will cover how to create and configure a generic script resource using the following methods:

1.       High Availability Wizard

2.       PowerShell CMDlets

3.       Cluster.exe command-line tool (To be deprecated after Windows Server 2008 R2)

We will be using a VB script as an example.  The example script can be found here: .


Before creating a generic script resource, please review the following checklist:

Cluster Configuration

I have a 2-node cluster running Windows Server 2008 R2. Cluster name is A1C1F4X64.

Name of my cluster nodes are:

1.       A1C1F4X64N1

2.       A1C1F4X64N2

Below is a partial screenshot of Failover Cluster Manager.

Create a Generic Script Resource using the High Availability Wizard

Now I will walk you through the High Availability wizard of Failover Cluster Manager to create a generic script resource.  Below are the steps:

1.       Launch Failover Cluster Manager from the Start Menu.

2.       Connect to the cluster.  Right click on Services and applications , and click on Configure a Service or Application…

3.       The High Availability Wizard appears. After reading the information presented on Before You Begin page, click Next .

4.       On Select Service or Application page, select Generic Script and click Next .

5.       On Generic Script Info page, provide the path to the script file. Click Next .

6.       On Client Access Point page, we will be providing input for the network name and IP addresses that clients will be using when accessing our highly available generic script.
I am choosing a network name (A1C1F4X64G Scr ) and a static IP address suitable for my network configuration.

Click Next .

7.       On Select Storage page, you have an option to choose a disk for the generic script. If the generic script needs a disk resource, you can select a disk.

My example script writes data to a file, so the script needs access to a shared disk.  I am choosing Cluster Disk 2 as my disk resource.  After making the storage selection, click Next .

8.       On the Confirmation page, verify that the information is correct. If you need to make modifications, you can use the Previous button to go back to the previous pages in the wizard and modify the information.

Click Next .

9.       Wizard should successfully create the generic script resource and bring the resource online.  The Summary page appears.

10.   On Summary page, you can click on View Report… button. This will show you detailed report of what actions were taken to create the Generic Script resource.

The report can also be located under %SystemRoot%\Cluster\Reports directory for later viewing. Click Finish .

11.   Locate the newly created item (A1C1F4X64G Scr ) under Services and applications . This is the container (also known as group) for the generic script resource.

The above image shows that group A1C1F4X64GScr is hosted on node A1C1F4X64N2. The name of the generic script resource is “GenericScriptTemplate Script”.

Create a Generic Script Resource using PowerShell CMDlets

I will now show you how to use PowerShell CMDlets to create a generic script resource.  The CMDlets that we need to achieve this are: Get-Cluster and Add-ClusterGenericScriptRole .

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-ClusterGenericScriptRole CMDlet.  This is needed to specify the cluster where the resource will be created.

If we are running PowerShell on a clustered node, Get-Cluster CMDlet may be omitted and Add-ClusterGenericScriptRole 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):

PS C:\Windows\wttbin> Get-Cluster A1C1F4X64 | Add-ClusterGenericScriptRole -ScriptFilePath C:\windows\wttbin\GenericScriptTemplate.vbs -Name A1C1F4X64GSCR -StaticAddress

Report file location: C:\Users\Daud\AppData\Local\Temp\tmp2B58.tmp.mht

Name                  OwnerNode            State

----                  ---------            -----

A1C1F4X64GSCR         a1c1f4x64n2          Online

Create a Generic Script Resource Using Cluster.exe

Cluster.exe is another command line tool that can be used to administer a cluster. Note that this tool is in the phase of being deprecated. This tool will coexist with PowerShell in Windows Server 2008 R2.  However, Cluster.exe will no longer be shipped after Windows Server 2008 R2.

Below is a sample script that creates and onlines a generic script resource.

REM Store cluster name in a variable

set ClusterName=A1C1F4X64

REM Create a group and online it

cluster %ClusterName% group GenScrGroup /create

cluster %ClusterName% group GenScrGroup /on

REM Create a IP address resource, set required properties, and online it

cluster %ClusterName% res GenScrIP /create /group:GenScrGroup /type:"IP Address"

cluster %ClusterName% res GenScrIP /priv address= SubnetMask=

cluster %ClusterName% res GenScrIP /on

REM Create a network name, set properties, set dependency on the IP resource, and online it

cluster %ClusterName% res GenSvcNN /create /group:GenScrGroup /type:"Network name"

cluster %ClusterName% res GenSvcNN /priv Name=%ClusterName%-NN

cluster %ClusterName% res GenSvcNN /setdep:"[GenScrIP]"

cluster %ClusterName% res GenSvcNN /on

REM Create a generic script resource, set the properties, and online it

cluster %ClusterName% res GenScrRes /create /group:GenScrGroup /type:"Generic Script"

cluster %ClusterName% res GenScrRes /prop RestartAction="0"

cluster %ClusterName% res GenScrRes /priv ScriptFilepath="C:\windows\wttbin\GenericScriptTemplate.vbs"

cluster %ClusterName% res GenScrRes /on

The script does the following:

1.       Creates and onlines a group called GenScrGroup .

2.       Creates an IP address resource called GenScrIP in group GenScrGroup .  Sets Address and SubnetMask properties of the resource.   Brings the IP resource online.

3.       Creates a network name resource called GenScrNN .  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.       Creates the generic application resource called GenScrRes , sets the properties, and brings the resource online.

Useful Links

·         Generic Script Resource Type -

·         Using The Generic Script Resource Type -

·         Scripting Entry Points -

·         Scripted Resource Example -

·         Checklist: Installing a Generic Script resource -

·         Resource Object -

·         Windows Clustering -

·         Generic Application blog:

·         Generic Service blog:

Daud Howlader
Software Development Engineer in Test
Clustering & High Availability

Version history
Last update:
‎Mar 15 2019 01:49 PM
Updated by: