Citrix Lifecycle Management provides a catalog of Citrix-supported Blueprints that you can use to deploy Citrix Solutions such as XenApp and XenDesktop, but in this blog I am going to walk through how you can use Citrix Lifecycle Management to create your own scripts and Blueprints.

We will create a simple, but useful Blueprint that deploys a Windows Server and gives it a name; the process will show you how to create a Blueprint in a manner that will allow you to re-use it as a component to build higher level Blueprints.

Step 1: Create script

We will use PowerShell as the scripting language for this Blueprint; the first task is to create a script to rename a Windows computer.

Navigate to the Design & Deploy tab in the Citrix Lifecycle Management console and click on the New Script link as shown below:


The New Script Wizard opens: give the script a name (RenameComputer); a type (ps1) and optionally a Description and Tags then press Next


You can either use the built-in editor to directly edit the script or copy/paste the script source from your favorite development tool. I use the latter approach, as I prefer to develop PowerShell scripts using the native PowerShell Integrated Scripting Environment on Windows.


Here is a tip for writing PowerShell scripts that interact well with the Citrix Lifecycle Manager platform:  use a try/catch block as a “wrapper” for your script code; the exception handler should write the error message to the output stream so that it is displayed in the Blueprint Deployment Report then exit the PowerShell script with a non-zero exit code to notify to the Citrix Lifecycle Manager platform that an error has occurred.

Once the script code is complete press Next to define the script parameters: in this case there is just one parameter of type string that is ComputerName. Also check the Required box, as this parameter must be supplied, and edit the Tooltip to give some helpful text describing the parameter


I also recommend that you always check the box Use named parameters for PowerShell scripts: this means that Citrix Lifecycle Manager will then pass named parameters to PowerShell when invoking the script which you will find a lot more flexible than the default positional parameter mechanism when you come to write more complex scripts.

Click Next and as there no attachments to be associated with this script press Finish to save the new script.

Step 2: Create Blueprint to rename computer

The next step is to create a blueprint container for the steps required to rename a Windows computer. At first glance you may find the blueprint structure I am using in this blog a little more complicated than is necessary, but bear with me and you will see as we move on how the pattern will help you to create a re-usable pallet of component Blueprints that you can use to compose more complex Blueprints.

To create the new Blueprint o back to the Design & Deploy tab and click on New Blueprint:


Give your component Blueprint a name: Create Named Computer, optionally add a Description and Tags and then click on the Deploy tab as shown below


Open up the My Scripts and Utility Step trees in the Blueprint Designer view as shown below:


Now drag and drop the RenameComputer script followed by the Reboot Step into your blueprint as steps 1 and 2:


Step 3: Define Blueprint parameters

Now we make this into a re-usable component by describing in the blueprint inputs the set of parameters required to execute this blueprint. In this case it is very simple – just the computer name.  Click on the Blueprint Inputs tab and create a new input parameter named Computer Name (notice we are not constrained here by PowerShell parameter naming rules, so we can create a more human readable name). Add a tooltip if further description of this parameter is required, and then click on the highlighted icon below to add a regular expression for parameter validation:


As far as I can work out a Windows computer name consists of between 1 and 15 alphanumeric (and dash “-“) characters with at least one alphabetic character so my regular expression illustrated above attempts to enforce this (I am sure to get comments about this). Also there is a field to allow you to enter an error message to be displayed if the data entered fails to match the regular expression.

Now the RenameComputer script at step 1 of the Blueprint needs to be “wired up” so that the value of this new Blueprint input parameter flows through to the script input: click on the Inputs tab of step 1 of the blueprint, and then click on the reference icon of the script input parameter ComputerName that I have highlighted below:


A Reference Tree dialog box will pop up – open up the Create Named Computer tree and check the Computer Name radio button so that the Blueprint input parameter is wired to the ComputerName parameter of the RenameComputer script.


Once wired up the reference appears as shown below. To keep the deployment view tidy, it is also advisable to uncheck the Visible box (see highlight below) so the script step parameter is no longer visible during the deployment step.


That is the component blueprint complete: press Save to complete the operation.

I recommend you follow this convention of describing all of the input requirements as Blueprint inputs – this allows you to treat the component (to some extent) as a black box and see at a glance what the component Blueprint input requirements are.

Step 4: Create Named Computer Blueprint

The next step is to create a Blueprint that can be deployed by Citrix Lifecycle Management to create a named computer.

Go back to the Design & Deploy view and press the New Blueprint link again and create a Blueprint called Named Computer. Add a description and Tags if you wish together with any resource location constraints (by default a Blueprint can be deployed on any resource location – if you wish to constrain where your blueprint is deployed, use the check boxes on the Overview tab to do so).

Click on the Deploy tab and drag a Server object from the Cloud Step in the Blueprint Designer followed by the Create Named Computer Blueprint from My Blueprints


Step 5: Configure and constrain Server object

The Citrix Lifecycle Management platform gives you as a Blueprint author a limited ability to constrain and guide the choices a deployer of your Blueprint may make. We will use these features to guide the deployment of this Blueprint

Click on the Options tab of the Server object. Creating 2 or more Windows computers with the same name does not really make much sense, so ensure the VM Instance Count is set to 1 and check the box that says Don’t allow changes during deployment.


Next click on the Recommend Config tab and enter the configuration that you wish to recommend for the deployment. I will illustrate this with values for Citrix XenServer only, but you can recommend configurations for each of the platforms you intend to support:

Use the Key drop down menu to select the constraint (e.g. XenServer VM Name) and give it a value, then press the + button (highlighted) to create another row in the table:


My completed list of recommendations for XenServer looks like this:


Note that you don’t have to make recommendations but they can be useful to provide safe default values for a deployer who may be unsure of which values to choose during deployment of your Blueprint.

Step 6: Configure Blueprint to run on Server

Now we need to configure the component Blueprint to run on the Server object that we are creating. Click on Select Servers in the Runs On tab of the Create Named Computer step:


A dialog box will open to select the servers; check the Blueprint radio button and then check the Server: All Servers box and press Done.


Step 7: Configure teardown

The deployment phase of the blueprint is now complete, click on the Manage tab followed by the Tear Down tab to define the tear down process for the blueprint:


The only tear down action that we will require this Blueprint to perform is to terminate any servers that it has created. Drag the Terminate Machine object from the Blueprint Designer into the Shutdown step:


Now click Save and your blueprint is complete!

Step 8: Test the blueprint

In the Design & Deploy view select the Named Computer blueprint and click Deploy


The deployment wizard will start and provide an architectural overview of the blueprint to be deployed: as you can see our use of a component blueprint (Create Named Computer) has resulted in Deployment architecture diagram that is illustrated below:


Follow the wizard through to completion, notice how the deployment picks up your recommended config from the server object.