How to Configure a Startup Script for Windows Azure Nodes using Windows HPC Server Node Templates

Download the script files associated with this topic from here.  Refer to the authoritative documentation for this topic here.

This feature functionality applies when utilizing Windows HPC Server to deploy compute nodes onto Windows Azure using the Cluster Configuration Manager from the head-node.

With Service Pack 3 (SP3) of Windows HPC Server 2008 R2 (November 2011 and later), Microsoft added the ability to specify integration with Windows Azure via Node Templates. When adding a new Node Template, you may optionally specify a node Startup Script as illustrated.


The startup script (e.g. nodeprep.cmd), is called during the Virtual Machine (VM) startup sequence upon deployment activation within a Windows Azure service. The script is executed only once and within system context on each VM instance within your deployment configuration as new nodes are added to the compute cluster.

Proper configuration of the startup script sequence involves not only specification of the script name within the template editor, but also addition of the nodeprep “package” to the blob storage account also associated with the Node Template. This package upload activity must be accomplished prior to adding any new nodes to the cluster. Hence, the cluster admin must execute an “InstallNodePrep.bat” type script from the head-node prior to adding new nodes within the context of the new Node Template.

Setup your scripts and package files on the head-node as illustrated below.  

  • Create a two-level folder structure containing your scripts and startup package files.  
  • File “c:\MyHeadNode\InstallNodePrep.bat” is executed from cmd.exe on your head-node. This script creates two .zip file “packages” that will be uploaded to the Blob storage account associated with your Node Template. Note the command line syntax within the cmd.exe window below wherein the corresponding node template is specified using the “-t” argument.
  • The first package is a zip of the file “c:\MyHeadNode\nodeprep\nodeprep.cmd”. Note that this file corresponds to the “nodeprep.cmd” script that you’ve specified within your Node Template configuration illustrated above. 
  • The second package is a zip of the folder “c:\MyHeadNode\nodeprep”.   


Now, when new Azure Node instances are added to your cluster, the “hpc sync” node configuration sequence will download these two packages automatically to the node-local “%CCP_PACKAGE_ROOT%” path.

Your “nodeprep.cmd” startup script will be unzip’ed and executed. Note, a good practice is to ensure that any .msi installer executions occur synchronously using the “start /wait” command syntax (see the sample files from the download link above). Concurrent installations are problematic and could create a difficult to diagnose race condition.  

A very useful startup script output log is produced at “e:\approot\HpcStartupCommand.log” on each VM instance. You will want to ensure that your startup script contributes stdout and stderr results to the log file as illustrated within the example files (refer to the download link above).