Introducing Citrix Workflow Studio The Partner Tech...

69
Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com Partner Tech Preview Introducing Citrix Workflow Studio The Partner Tech Preview

Transcript of Introducing Citrix Workflow Studio The Partner Tech...

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com

Partner Tech Preview

Introducing Citrix Workflow Studio

The Partner Tech Preview

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

I n d e x | i

Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com

Contents

INTRODUCTION ............................................................................................................................................................... 1

DYNAMIC DELIVERY ............................................................................................................................................................. 1

PROCESS AUTOMATION ........................................................................................................................................................ 1

WELCOME TO CITRIX WORKFLOW STUDIO ..................................................................................................................... 2

BUSINESS POINTS ADDRESSED:............................................................................................................................................... 2

TECHNICAL POINTS ADDRESSED: ............................................................................................................................................. 2

WORKFLOW STUDIO COMPONENTS: .............................................................................................................................. 3

WORKFLOW STUDIO CONSOLE ............................................................................................................................................... 4

REQUIREMENTS ................................................................................................................................................................... 4

WHAT EXACTLY WAS INSTALLED? ............................................................................................................................................ 4

WORKFLOW STUDIO RUNTIME ............................................................................................................................................... 5

REQUIREMENTS ................................................................................................................................................................... 5

WHAT EXACTLY WAS INSTALLED? ............................................................................................................................................ 5

UNDERSTANDING THE WFS CONSOLE ............................................................................................................................. 6

TASK PANE ......................................................................................................................................................................... 6

DESIGN SURFACE ................................................................................................................................................................. 6

CONFIGURATION PANE ......................................................................................................................................................... 6

WORKFLOW EXECUTION RESULTS ........................................................................................................................................... 6

WORKFLOW STUDIO CONCEPTS.............................................................................................................................................. 8

WORKFLOW STUDIO INTERFACE ............................................................................................................................................. 9

TASK PANE ......................................................................................................................................................................... 9

DESIGN SURFACE ................................................................................................................................................................. 9

CONFIGURATION PANE ........................................................................................................................................................10

WORKFLOW EXECUTION RESULTS ..........................................................................................................................................10

WORKFLOW STUDIO TASKS ..................................................................................................................................................11

TASK BEHAVIOR PROPERTIES .................................................................................................................................................13

TASK COMMON PROPERTIES..................................................................................................................................................13

TASK DESIGN PROPERTIES .....................................................................................................................................................14

TASK RUN RESULTS PROPERTIES .............................................................................................................................................15

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

I n d e x | ii

Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com

TASK EXECUTION RESULTS.....................................................................................................................................................16

WORKFLOW STUDIO CONSOLE ......................................................................................................................................17

GLOBAL SETTINGS ...............................................................................................................................................................17

WORKFLOW DESIGN ...........................................................................................................................................................18

WORKFLOW EXECUTION ......................................................................................................................................................19

WORKFLOW CONTROL TASKS ........................................................................................................................................20

BREAK TASK ......................................................................................................................................................................20

CATCH EXCEPTION TASK .......................................................................................................................................................20

FOR EACH OBJECT TASK .......................................................................................................................................................21

IF/THEN/ELSE TASK ............................................................................................................................................................21

JOIN TASK .........................................................................................................................................................................21

SLEEP TASK........................................................................................................................................................................21

SPLIT TASK ........................................................................................................................................................................21

WHILE TASK ......................................................................................................................................................................22

WORKFLOW END TASK ........................................................................................................................................................22

WORKFLOW START TASK .....................................................................................................................................................22

CREATING YOUR FIRST WORKFLOW ...............................................................................................................................23

USING WORKFLOW TEMPLATES .....................................................................................................................................30

ACTIVE DIRECTORY TEMPLATES .............................................................................................................................................31

CITRIX XENSERVER TEMPLATES .............................................................................................................................................31

GROUP POLICY TEMPLATES ..................................................................................................................................................31

WINDOWS MANAGEMENT TEMPLATES ...................................................................................................................................31

RUNNING WORKFLOWS .................................................................................................................................................33

VARIABLES......................................................................................................................................................................35

WHAT ARE VARIABLES? .......................................................................................................................................................35

THE SYNTAX OF VARIABLES ...................................................................................................................................................35

THE SPECIAL VARIABLES .......................................................................................................................................................35

HOW TO USE VARIABLES ......................................................................................................................................................36

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

I n d e x | iii

Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com

CONDITIONS ...................................................................................................................................................................40

CONDITIONS AND SUB-TASKS ...............................................................................................................................................40

CONDITION PROPERTY .........................................................................................................................................................41

IN THE CASE OF THE EXECUTE CONDITION ................................................................................................................................41

IN THE CASE OF THE WHILE TASK ............................................................................................................................................42

IN THE CASE OF THE IF/THEN/ELSE TASK..................................................................................................................................42

OPERATORS ....................................................................................................................................................................43

COMPARISON OPERATORS ....................................................................................................................................................44

ASSIGNMENT OPERATORS ....................................................................................................................................................45

LOGICAL OPERATORS ...........................................................................................................................................................45

BITWISE OPERATORS ...........................................................................................................................................................45

REDIRECTION OPERATORS ....................................................................................................................................................45

DEBUGGING ...................................................................................................................................................................46

ERROR HANDLING ..........................................................................................................................................................49

CATCH EXCEPTION TASK .......................................................................................................................................................49

STOP ON ERROR PROPERTY ..................................................................................................................................................51

RUN RESULT VARIABLE ........................................................................................................................................................52

TASK LIBRARY .................................................................................................................................................................54

ACTIVE DIRECTORY TASKS ....................................................................................................................................................54

CITRIX NETSCALAR ..............................................................................................................................................................55

CITRIX PROVISIONING SERVER ...............................................................................................................................................56

CITRIX XENSERVER ..............................................................................................................................................................57

GROUP POLICY TASKS ..........................................................................................................................................................57

INPUT/OUTPUT TASKS.........................................................................................................................................................58

MESSAGING TASKS .............................................................................................................................................................58

WINDOWS TASKS ...............................................................................................................................................................59

WINDOWS POWERSHELL TASKS ............................................................................................................................................60

WORKFLOW CONTROL TASKS................................................................................................................................................60

WORKFLOW FUNCTION TASKS ..............................................................................................................................................60

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

I n d e x | iv

Introducing Citrix Workflow Studio By Rich Crusco @ Frameworkx.com

WORKFLOW AND POWERSHELL .....................................................................................................................................61

.NET OBJECTS ...................................................................................................................................................................61

POWERSHELL SYNTAX .........................................................................................................................................................61

PIPING OBJECTS .................................................................................................................................................................61

WORKFLOW STUDIO VARIABLES ............................................................................................................................................62

WORKFLOW STUDIO POWERSHELL GLOBAL RUNSPACE ..............................................................................................................62

WORKING WITH POWERSHELL RUNSPACE AND WORKFLOW VARIABLES ........................................................................................63

CITRIX WORKFLOW STUDIO COMPOSER ........................................................................................................................64

CONCLUSION ..................................................................................................................................................................64

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 1

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Introduction Due to the popularity on a series of postings I made previewing Citrix Workflow Studio on Frameworkx.com Citrix Workflow Studio – Partner Tech Preview Part 1 Citrix Workflow Studio – Partner Tech Preview Part 2 Citrix Workflow Studio – Partner Tech Preview Part 3 Citrix Workflow Studio – Partner Tech Preview Part 4 Citrix Workflow Studio – Partner Tech Preview Part 5 Citrix Workflow Studio – Partner Tech Preview Part 6 I have put together this document as a compilation of those postings I released on the Citrix Workflow Studio Partner Tech Preview. There was an overwhelming demand for me to put all of the posts into one document for easier reading, portability, and printing. So here it is, the complete preview of Citrix Workflow Studio, a powerful orchestration tool for a dynamic delivery center.

Dynamic Delivery Citrix offers a new and different approach - the Citrix Delivery Center - which transforms the datacenter from a static, production-oriented facility to a dynamic, service-oriented delivery center. The Citrix Delivery Center enables IT to orchestrate the delivery of application, desktop and server resources in lock-step with to the needs of the business. It is an end-to-end application delivery infrastructure system that delivers applications to users, anywhere with the best performance, highest security, lowest cost and maximum agility and flexibility.

Process Automation Workflow Studio, a member of the Citrix Delivery Center product family, is an IT process automation solution that enables you to compose, integrate and orchestrate rule-based workflows across your application delivery infrastructure. Workflow Studio acts as the glue across the IT infrastructure allowing administrators to easily tie technology components together via workflows that enable the system to truly operate as a dynamic delivery platform. The orchestration of technology components into a seamless, integrated delivery system is mandatory to provide a dynamic infrastructure that can respond to changes in user demand or other external factors. By doing so, IT organizations realize the cost savings; support staff efficiencies; and improved user experience necessary to drive competitive advantage and deliver business value. Workflow Studio unlocks the potential in Microsoft PowerShell and the Windows Workflow Foundation by providing an easy to use, graphical interface for workflow composition that virtually eliminates scripting. Workflow Studio is pre-populated with task libraries that interface with all Citrix products, Citrix-ready solutions and 3rd party offerings, providing out of the box capabilities to drive provisioning, configuration and other management functions in an automated fashion.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 2

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Welcome to Citrix Workflow Studio Workflow Studio is a new platform that enables simple yet enterprise-scale data center and business process automation through the power of Windows PowerShell and the flexibility of Windows Workflow Foundation. Through a graphical workflow designer, you can build full automation of your business and/or IT processes including user account management, server and application provisioning, security enforcement and automation, disaster recovery automation, and routine and emergency maintenance on data center resources.

Business Points Addressed: · Complete Solution - Provides automated end-to-end creation, provisioning, and deployment of datacenter servers. · Ensures Compliance - Tracks and controls via workflow, common administration tasks. · Maintains Standards - Enforces consistent, streamlined automation of business rules and practices. · Improves Efficiency - Significantly reduces server administration workload using scripting, workflow, graphical administrative console, and reporting capabilities. · Promotes Rapid ROI - Automates the management of datacenter servers for potentially millions of users.

Technical Points Addressed: · Simplifies Server Configuration Creation - Pre-configured tasks provide step-by-step guide for configuring complex or standard server settings and then outputs them into a PowerShell script. · Automates Server Configuration Approval and Audit - Allows administrators to create workflows for administrative tasks with built-in audit and approval steps. · Automates Server Deployment - The PowerShell extensions allow IT administrators to script server settings using Cmdlets. · Adapts Server Configuration to Organization - The workflow UI and wizards are completely customizable and editable for custom workflow configurations. · Enables Workload Delegation - Once a workflow is created, it can be delegated to other administrators for editing and execution.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 3

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Components: You can install either or both components on the same computer, but you will likely not want to do so in most common circumstances. Instead, if you are going to be creating, editing, or debugging workflows on your computer you will need to install the Workflow Studio Console (WFSConsole.msi) component. If you want to be able to execute workflows on a computer where you will not be creating, editing, or debugging workflows you will need to install the Workflow Studio Runtime (WFSRuntime.msi) component on that computer.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 4

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Console The WFS console consists of a Windows user-interface that allows you to easily create new, edit existing, debugging, and execute workflows. You install the Workflow Studio Console component using the WFSConsole.msi installation file.

Requirements The console is supported on the following operating systems: · Windows XP SP2 (x86 or x64) · Windows 2003 Server SP1 or higher (x86 or x64) · Windows Vista (x86 or x64) · Windows 2008 Server (x86) The following prerequisites are also required to be installed before the WFS console can be successfully installed: · Microsoft .NET Framework Version 2.0 Redistributable Package · Windows PowerShell 1.0

What Exactly Was Installed? The Workflow Studio Console installation installs the following components:

Component Identifier Description

Workflow Studio Console WFStudio.exe The Workflow Studio Console application executable.

Workflow Studio online help WFSHelp.chm The Workflow Studio online help file.

Active Directory Task Library ActiveDirectoryTaskLibrary.dll The Active Directory Task Library.

Group Policy Task Library GPMCTaskLibrary.dll The Group Policy Task Library.

Citrix Provisioning Server Task Library ArdenceTaskLibrary.dll The Citrix Provisioning Server Task Library.

Citrix XenServer Task Library XenTaskLibrary.dll The Citrix XenServer Task Library.

Input/Output Task Library InputOutputTasksLibrary.dll The Input/Output Task Library.

PowerShell Task Library PowerShellWFTaskLibrary.dll The PowerShell Task Library.

Windows Task Library WindowsTaskLibrary.dll The Windows Task Library.

Workflow Control Task Library WorkflowControlTaskLibrary.dll The Workflow Control Task Library.

Release Notes Documentation\Citrix Workflow Studio Release Notes.pdf

The Release Notes document.

Default Workflow Folder My Documents\Workflow Studio The default workflow folder. This is the default location for all new workflows to be saved. You can change this location on the Tools\Options dialog.

Default Workflow Template Folder My Documents\Workflow Studio\Workflow Templates

The default workflow template folder. This is the default location for all workflow templates. You can change this location on the Tools\Options dialog. Several templates are also included with the Workflow Studio installation.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 5

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Runtime As the name implies, the runtime is purely an execution engine for workflows created using WFS. You install the Workflow Studio Runtime component using the WFSRuntime.msi installation file.

Requirements The console is supported on the following operating systems: · Windows XP SP2 (x86 or x64) · Windows 2003 Server SP1 or higher (x86 or x64) · Windows Vista (x86 or x64) · Windows 2008 Server (x86) The following prerequisites are also required to be installed before the WFS console can be successfully installed: · Microsoft .NET Framework Version 2.0 Redistributable Package · Windows PowerShell 1.0

What Exactly Was Installed? The Workflow Studio runtime installation installed the following components:

Component Identifier Description

Workflow Studio Console WFStudio.exe The Workflow Studio Console application executable.

Active Directory Task Library ActiveDirectoryTaskLibrary.dll The Active Directory Task Library.

Citrix Provisioning Server Task Library ArdenceTaskLibrary.dll The Citrix Provisioning Server Task Library.

Citrix XenServer Task Library XenTaskLibrary.dll The Citrix XenServer Task Library.

Group Policy Task Library GPMCTaskLibrary.dll The Group Policy Task Library.

Input/Output Task Library InputOutputTasksLibrary.dll The Input/Output Task Library.

PowerShell Task Library PowerShellWFTaskLibrary.dll The PowerShell Task Library.

Windows Task Library WindowsTaskLibrary.dll The Windows Task Library.

Workflow Control Task Library WorkflowControlTaskLibrary.dll The Workflow Control Task Library.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 6

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Understanding the WFS Console The WFS user interface consists of four panes:

Task Pane The task pane displays all of the tasks that have been included with or installed for WFS. These tasks are shipped as part of task libraries. Each library consists of one or more .dll files that must exist in the WFS program files folder. The WFStudio.exe executable will look for any valid task libraries in the same folder automatically on startup and will load the tasks it finds in any of the installed task libraries. You can also create your own custom task libraries or install and use tasks created by other WFS users. The task library author determines where in the treeview WFS organizes each task. Citrix recommends organizing by function and/or by the technology they target. WFS also provides workflow logic tasks that allow you to connect tasks together in logical ways, such as the Split/Join task and the If/Then/Else task.

Design Surface Use the design surface to assemble tasks into workflows. Select workflow tasks, drag and drop the tasks onto the design surface, and then order and connect tasks in the order in which you want the workflow to execute. In order to connect tasks together, you simply drag and drop the output connector of one task to the input connector of another, or vice versa.

Configuration Pane Use the configuration pane to view and modify task properties, which alters the behavior of each task at workflow runtime. Normally the task-specific properties are grouped together under the property group heading of "Behavior". Some tasks depart from this however in order to subdivide the properties into related groups.

Workflow Execution Results The workflow execution results pane displays the results of the workflow. If a task failed, the workflow execution results pane shows which task failed, and the Last Error column displays error details.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 7

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

The following is a screenshot of the Citrix Workflow Studio Conole:

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 8

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Concepts It is important to understand some common concepts before getting started using Workflow Studio (WFS). Below is a list of concepts and their definitions as it applies to WFS.

Concept Definition

Task A task is element of execution in a workflow. A workflow is made up of two or more tasks that are connected in a logical and meaningful way.

Task Property A task property is a configuration option that modifies the behavior of a task. There may be zero or more properties exposed by a task.

Workflow A workflow is a collection of two or more tasks that are linked together in a desired order of execution.

Execution Path The execution path of a workflow is the logical path of connected tasks that were executed after the workflow was started. The execution path may vary between workflow starts and is solely dependent on how the workflow is constructed.

Design Surface The design surface is the center portion of the WFS console where you drag and drop tasks to create a new workflow. Once tasks are on the design surface, you can connect them together to form an execution path by clicking on the output connector of one task and dragging to the input connector of another task, or vice versa.

Property Pane The property pane is the pane in the WFS console that displays the configuration properties of the selected task on the design surface.

Navigation Pane The navigation pane is the pane in the WFS console that displays the installed task libraries. Each task library adds one or more tasks to the navigation pane's tree view. You can drag and drop tasks from the navigation pane to the design surface to create workflows.

Output Pane The output pane is in the WFS console displays workflow execution information and on each task that is executed in the workflow.

Debugging Debugging is a process of finding problems with a computer program and changing the program to eliminate the problem.

Workflow Template A workflow template is a predefined workflow that you can create a new workflow based on. This template will be applied to the new, blank workflow and you can use it as a starting point for creating your own workflow, or you can use the workflow template as-is.

Design Surface Level Workflow Studio allows you to define sub-tasks to tasks in your workflow. These tasks are located on a design surface virtually below the parent task. You access these lower levels by double-clicking on any task on the design surface. When you do this you will be automatically taken to the design surface level below the task you double-clicked on (now known as the parent task). Sub-tasks are executed after the parent task is executed but before tasks that are connected to the parent tasks output connecters are executed.

Pan Mode Pan Mode allows you to "grab" the background of the design surface and move the surface in any direction you chose. You can use this function to view tasks on the design surface that are no longer visible in the on-screen area of the design surface.

Select Mode Select Mode allows you to "draw" a rectangle around one or more tasks and have those tasks selected. When you have tasks selected you can left-click on one of the selected tasks and you can move them around on the design surface. Additionally, you can right-click on any selected task and perform some actions on the selected tasks, or you can press the delete key which will delete the selected tasks from the design surface.

Event Logging Event logging configuration in WFS can be found on the Options dialog which is accessed from the Tools menu. These event logging options control which event conditions WFS will log to the Windows Event Logs.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 9

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Interface The WFS user interface consists of four panes:

Task Pane The task pane displays all of the tasks that have been included with or installed for WFS. These tasks are shipped as part of task libraries. Each library consists of one or more .dll files that must exist in the WFS program files folder. The WFStudio.exe executable will look for any valid task libraries in the same folder automatically on startup and will load the tasks it finds in any of the installed task libraries. You can also create your own custom task libraries or install and use tasks created by other WFS users. The task library author determines where in the treeview WFS organizes each task. Citrix recommends organizing by function and/or by the technology they target. WFS also provides workflow logic tasks that allow you to connect tasks together in logical ways, such as the Split/Join task and the If/Then/Else task.

Design Surface Use the design surface to assemble tasks into workflows. Select workflow tasks, drag and drop the tasks onto the design surface, and then order and connect tasks in the order in which you want the workflow to execute. In order to connect tasks together, you simply drag and drop the output connector of one task to the input connector of another, or vice versa.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 10

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Configuration Pane Use the configuration pane to view and modify task properties, which alters the behavior of each task at workflow run time. Normally the task-specific properties are grouped together under the property group heading of "Behavior". Some tasks depart from this however in order to subdivide the properties into related groups.

Workflow Execution Results The workflow execution results pane displays the results of the workflow. If a task failed, the workflow execution results pane shows which task failed, and the Last Error column displays error details.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 11

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Tasks

Tasks Tasks provides workflow logic that allow you to connect tasks together in logical ways Start All workflows start with this task

End All workflows end with this task

Input Connector The input connector(s) are always on the top of the task bubble

Output Connector The output connector(s) are always located on the bottom of the task bubble

Multiple connectors Most tasks only have one input and one output, but some have more than one input and/or more than one output connector. Two examples are the Join and Split tasks.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 12

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Executing When a task is executing it will blink Yellow

Success When a task successfully executes, it will turn green

Condition When a task execute condition encounters a problem, it will turn dark green

Error When a task encounters a problem executing it will turn red

Selected When you select a task, the selected task will be turned orange

Inactive When you elect to disable a task the task will be turned gray

Inactive Last Run When a workflow is executed a disabled task will be turned dark grey

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 13

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Task Behavior Properties The Behavior property group contains the following properties:

Backdrop Appearance Allows you to specify the appearance of the backdrop displayed when the workflow starts. WFS displays the backrop only if you set the Show Backdrop Frame property to True. Show Visual Queue Window Allows you to display a backdrop when the workflow runs. If you select ‘True' then the message that is entered on each task in the ‘Visual Queue Message' property will be displayed on the backdrop frame when the tasks are executed.

Task Common Properties The Common property group contains the following properties:

Comment The Comment property allows you to add a text description of the tasks desired behavior in the current workflow. This is similar to comments in source code. Execute Condition The Execute Condition property allows you to define a condition statement that will determine whether the selected task will execute at workflow runtime or not. If you do not enter a condition statement the task will execute. If you enter a condition statement that evaluates to True, the task will execute. If you enter a condition statement that evaluates to False, the task will not execute. Log to Event Log The Log to Event Log property allows you to define on a task-by-task basis whether WFS will create a Windows Application Event Log entry if you also select the Task Activity Logging option in the Tools\Options dialog. Notify Parent of Run Result When a task is executed it will report to its parent its Run Result. This informs any parent tasks whether there was a problem executing a sub-task. If this property is set to True and the task encounters an error, for example, it will propagate that error condition to its parent, and the parent will also tur n red. If the parent has a parent and this property on the parent set to True, that same error condition will continue propagating until either no more parents are found or until a parent with this property set to False is found.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 14

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Note: All run result conditions will be propagated, not just errors as in the example just given. There is an order of precedence of the propagated run result. Error will supersede Condition Failed which will supersede Succeeded. Run Result Variable If you want to assign the run result of the selected task to a variable you can do so by supplying a variable name for the Run Result Variable property. The task will assigned the variable a string value depending on the run result of the task. The string values corresponding to each run res ult are:

Run Result Variable Value

Succeeded "Succeeded"

Condition Failed "Condition Failed"

Error "Error"

Stop on Error The Stop on Error property allows you to define the behavior of the workflow, task by task, when a task encounters an error. If this property is set to True (the default for all new tasks) if the task encounters an error the workflow will not process tasks connected to the output of the task that encountered the error. If there are other branches of the workflow executing those branches will be unaffected by the task that has hit an error. See the Handling Errors help document for more information on how to handle errors in an efficient and intelligent way. Task Status The Task Status property allows you to, at will, disable any task you chose. By making a task inactive you simply cause the task to be skipped when the workflow execution path hits the task. The task will turn gray on the design surface if it is marked as inactive so that you can easily identify its status. Visual Queue Message The Visual Queue Message is a text message that is displayed on the Visual Queue Window, if the queue window is enabled in the Workflow Start task. The Visual Queue Window is a simple windows form UI. Each Visual Queue Message entered into each task will be displayed on the visual queue window when the task is executed. This can be used to give users some interactive feedback on the status of a workflow.

Task Design Properties The Design property group contains the following properties:

Task Description The Task Description property allows you to add a text description of the task. This text description will be shown when on a mouse over event with a pop up dialog. Task Name The Task Name property allows you to modify the name of the task. This name will be shown on the task bubble and in the execution results window.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 15

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Task Run Results Properties The Run Results property group contains the following properties:

Last Error A text message displaying the error that occurred after the last time this task was run. If no error occurred, this property should display, "No Exception". Last Exception The exception that was thrown during the last time this task was run. If a task encounters an exception this property will include a text message of the exception encountered. If no exception is thrown, this property should contain the text "No Exception". Run Result Displays a number that represents the Run Results property for the task. Time Completed The time that the task completed its duties. Workflow Variables After The entire list of workflow variables exactly as they were passed to this task after the task was run. Note that this property will only be filled out if the Workflow -> Debugging On option is selected. Workflow Variables Before The entire list of workflow variables exactly as they were passed to this task before the task was run. Note that this property will only be filled out if the Workflow -> Debugging On option is selected. Note: There are some select tasks that do not expose the Execution Condition and/or the Task Status properties. This is done intentionally because for some tasks these properties either don't make sense due to the behavior of the task or because the properties would have no effect on the tasks.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 16

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Task Execution Results The workflow execution results pane provides the following columns:

ID Displays an ID automatically generated by WFS that shows the order in which WFS ran tasks. Activity Displays a summary of what activity the task performed. Task Name Displays the name of the task. Run Result Displays a number that represents the Run Results property for the task. Last Error Displays the error listed in the Last Error property for the task. Note: The Run Results information in the workflow execution results pane is different from the Run Results information displayed in the Run Results property section for a task. The Run Results displayed in the workflow execution results pane shows all task successes and failures in one location. This is very helpful when you have tasks defined on multiple levels of the design surface. The Run Results task property information in the configuration pane provides Run Results for a specific task.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 17

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Studio Console

Global Settings In the Global Settings section of the Options dialog you can set up the event logging options. All events are written to the Application Windows Event Log with a source of "Workflow Studio". All Global Settings apply to all accounts that run Workflow Studio on this computer. There are two different sets of events you can configure: Workflow Events Workflow events will tell you when a workflow starts and completes (Informational events), if the workflow has any problems executing (Warning events), and if the workflow fails during execution (Error events). Task Events Task logging will tell you when each task starts and completes (Informational events), when each task has a problem (Warning events), and when the task fails during execution (Error events). You also have the option of logging each task‘s activity log (the information you see in the Activity column of the Output Pane) to the event log by checking the "Log Activity Events" option.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 18

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Design In the Workflow Design Settings section of the Options dialog you can set up the folder options. Each account that runs Workflow Studio will have their own Workflow Design settings There are two different folders you can configure: Default Workflow Folder The Default Workflow Folder the folder where workflows you create will be saved by default. You have the ability to save a workflow to any folder you choose using the File\Save As menu option also. The default workflow folder is, by default, your My Documents\Workflow Studio folder. If you want to change that location just change the "Default Workflow Folder" configuration option. You can specify a UNC (\\server\share\folder) path for the Default Workflow Folder location. Workflow Templates Workflow Templates can be used to help you create new workflows based on common practices. These workflows help you get started creating a new workflow by doing a lot of the initial work for you. When you create a new workflow you have the option of creating the new workflow file based on an existing template. The default folder where the workflow templates are stored is you're My Documents\Workflow Studio\Workflow Templates folder. You can change that default folder here. You can specify a UNC (\\server\share\folder) path for the Workflow Template Folder location.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 19

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Execution In the Workflow Execution section of the Options dialog you can select whether to have workflow debugging enabled. Each account that runs Workflow Studio will have their own Workflow Execution settings.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 20

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow Control Tasks The Workflow Control tasks provide you the control logic necessary to truly create workflows that automate manual processes. These control tasks give you all of the power of an advanced programming language without having to write a single line of code. These tasks allow you to direct/alter the path of workflow execution in order to automate the decision-making that otherwise has to be done by individuals. Additionally, some of the Workflow Control tasks allow you to create a multi -threaded (multi-tasking) workflow, handle errors that may occur in your workflows, and terminate your workflow.

Break Task This task breaks execution in a looping task (like the For Each Object or While tasks) to continue the workflow at the next task after the containing looping task.

Catch Exception Task This task catches any exception thrown by any task upstream from the task in the workflow. This task then allows the workflow to continue from its output.

Property Name Description Type

Behavior

Exception Caught Indicates whether this task was reached as a result of an exception (True) or via normal workflow flow (False).

Boolean

Exception Type Allows you to specify a string that contains the name of a C# exception type to catch. The default string value for this property is System.Exception. System Exception catches all exceptions.

C# exception type

Exception Variable Allows you to specify a variable name for the variable that holds a Boolean value if the task catches any exception. Specify a string that contains the name of the variable. Your string should start and end with the dollar-sign($) character.

$variable

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 21

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

For Each Object Task This task runs all subtasks once for each member of a collection. A collection is any Microsoft .NET object that implements the IEnumberable interface.

Property Name Description Type

Behavior

Input Variable Allows you to specify a name for the variable that contains the iterated collection.

$variable

Iterating Variable Allows you to specify the name of the variable that contains each item in the collection referenced by the subtasks. The task ignores this property if the Input Variable property contains a DataSet or DataTable object. The task only uses the Iterating Variable property if the Input Variable property contains a Microsoft .NET collection that implements the IEnumerable interface.

$variable

If/Then/Else Task This task allows the workflow to proceed out of the left or right output based on the result of the If Condition property.

Property Name Description Type

Behavior

If Condition Allows you to specify how you want the workflow to continue based on an evaluation of the condition. If the condition specified evaluates to True, the workflow proceeds out of the left output. If the condition evaluates to False, the workflow proceeds out of the right output.

String

Join Task This task brings multiple workflow execution paths back into a single path.

Property Name Description Type

Behavior

Wait for All Inputs Allows you to specify if you want to wait for all tasks connected to the inputs of the Join task to complete before executing the next task. If you specify True, the Join task does not pass control on to the next task until all inputs execute. If you specify False, the task and subsequent tasks execute immediately after the first input task completes.

Boolean

Sleep Task This task temporarily suspends workflow execution.

Property Name Description Type

Behavior

Sleep Time (seconds) Allows you to specify the number of seconds to wait before continuing workflow progress.

Integer

Split Task This task splits the path of the workflow into multiple paths. Each split task provides four splits. Each path coming from a split task continues on its own thread, and all paths execute simultaneously

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 22

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

While Task This task runs subtasks indefinitely until the If Condition property returns a value of False.

Property Name Description Type

Behavior

If Condition Allows you to specify the condition to evaluate. If the condition specified is True, the workflow runs the subtasks and evaluates the If Condition again each time the subtasks complete. If the condition specified in this property is False, the workflow proceeds out of the output

String

Workflow End Task This task ends the workflow. This task is optional but can be used if you want to log the end of the workflow. This task also has the ability to output the workflow log results to an XML file formatted for display as HTML.

Property Name Description Type

Behavior

Create Destination Folder If the destination folder does not exist, it will be create if this parameter is 'True'.

Boolean

Create Unique Log File Specify whether the log file name should be unique by adding the date\time stamp to the end of the file name. The resulting log file format is: <Workflow Name> Workflow Log - <YYYY-MM-DD HH-NN-SS>.html Where <Workflow Name> is the name of the current workflow, YYYY is the four-digit year, MM is the two-digit month, DD is the two-digit day, HH is the two-digit hour (in 24-hour format), NN is the two-digit minute, and SS is the two-digit second of the time at which the workflow ended.

Boolean

Log File Location Enter the full path to the folder where you want the workflow log file saved.

String

Log File Name Enter the name of the log file to be saved. The default name used if not name is given is: <Workflow Name> Workflow.html Where <Workflow Name> is the name of the current workflow.

String

Overwrite Existing Log If the log file already exists, it will be overwritten if this parameter is 'True'.

Boolean

Workflow Start Task This task starts the workflow. All workflows must start with a Workflow Start task. Workflows cannot run without a Workflow Start task connected to another task.

Property Name Description Type

Behavior

Backdrop Appearance Allows you to specify the appearance of the backdrop displayed when the workflow starts. WFS displays the backrop only if you set the Show Backdrop Frame property to True.

Backdrop Form Editor

Show Backdrop Frame Allows you to display a backdrop when the workflow runs. If you select ‘True' then the message that is entered on each task in the ‘Visual Queue Message' property will be displayed on the backdrop frame when the tasks are executed.

Boolean

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 23

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Creating Your First Workflow 1. Create a New Workflow with the name "Hello"

2. Click OK and the Citrix Workflow Studio modules will start to load

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 24

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

3. The main console will appear and you will have the Workflow Start task on the design surface

4. The first thing we need to do is drop the User Input task to the design surface. The User Input task is located in the Input/Output task folder. Just click on the User Input task and drag it to the design surface while holding the left mouse button while you move the mouse over to the design surface. Drop the task on the design surface by simply releasing the left mouse button.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 25

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

5. Next, we want to display the "Hello" message to the user.

We can do this using the Message Box task. The Message Box task is also located in the Input/Output task folder. Drag and drop the Message Box task on the design surface below the User Input task.

6. Next, we need to connect these new tasks in the order we want them to execute, following the Workflow Start task. To connect the output connector of the Workflow Start task to the input connector of the User Input task simply click on the output connector on the Workflow Start task and drag to the input connector and release the mouse button.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 26

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Alternatively you can select the two tasks you want to connect, right click on one of the selected tasks and select Connect Selected Tasks.

Now, all that is left is to configure each of the tasks.

7. Click on the User Input task to display its properties in the configuration pane.

Set the Message property to "What is your name?" Set the Window Title property to "First Question" Since we want to be sure they enter their name set the Input Required property to True. Note: Notice that the Output Variable is, by default, $UserInput. You can change this to any variable name you like, just be sure to start your variable name with a dollar sign ($) to indicate that it is a variable.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 27

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

8. Select the Message Box task.

Set the Message Text property to "Hello $UserInput" Set the Window Title property to "Greetings" Note: If you changed the name of the User Input's Output Variable in step 12 replace $UserInput with the name of the variable you chose.

That's it, you are ready to run your first workflow. 9. Press the Start button on the toolbar

Enter your name in the text box and click OK.

10. Now, wasn't that simple?

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 28

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

During the execution of the workflow you may have noticed in the console as each step in the workflow progressed, the status of that task would change as the task was being executed. When the workflow started the Workflow Start Task turned Green for Success and then the User Input Task started blinking Yellow

When you entered you name and clicked ok The User Input Task completed and turned Green for Success And the Message Box Task started blinking Yellow

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 29

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

When you clicked ok to the Greetings Message Box The Message Box Task turned Green for Success

And Finally the Workflow Execution Results

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 30

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Using Workflow Templates Workflow templates are pre-made workflows that are designed to give you an advanced start at creating workflows for some common scenarios. Some templates are meant for you to use to extend and customize for use in your environment while others are intended to be used primarily for learning purposes. The workflow templates are only installed with the WFS console component and are installed in you're My Documents\Workflow Studio\Workflow Templates folder. You can change the default location for your templates in the Tools\Options dialog. When you start Workflow Studio you will see an option that allows you to create a new workflow based on one of the existing templates, as shown here:

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 31

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Active Directory Templates

Citrix XenServer Templates

Group Policy Templates

Windows Management Templates

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 32

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Here is an example of the Citrix XenServer template for starting VMs on a XenServer

You can create new workflow templates and publish them for others to use by simply creating a workflow and selecting the File\Save As Template menu option. The new workflow template will be saved to your default workflow template folder (defined/adjustable in the Tools\Options dialog). Note: Workflow templates have a file extension of .wft whereas workflow files have a file extension of .wfs. Note: The workflow runtime component does not install any workflow templates.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 33

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Running Workflows Once you have a workflow written and debugged you will want to execute (run) the workflow. How you execute the workflow depends greatly on several factors. To make a decision on how to execute the workflow, answer the following questions: What does the workflow do? Who is intended to run the workflow (end-user, administrator, neither)? What computer the workflow needs to run on (server, end-user's computer, or an administrator's computer)? Does the workflow require user input or provide visual output for a user/administrator? Some other factors to consider include which Workflow Studio component you have installed on the various computers you are intending to run your workflow on. There are different capabilities for running workflows between the console and runtime components. The following table outlines each components capability:

Workflow Execution Method WFS Console WFS Runtime

Start Toolbar button X

Workflow\Start menu X

F5 key X

"Run from Here" command X

-RunOnLoad command-line switch X

-Load command-line switch X

-Run command-line switch X X

Switchless command-line argument X

In the WFS console you can load your workflow and click on the Start toolbar button. Your workflow will start executing from the Workflow Start task. If you want to stop the workflow execution, you can click the Stop toolbar button. In the WFS console you can select the Workflow\Start menu to start the workflow. Your workflow will start executing from the Workflow Start task. If you want to stop the workflow execution, you can click the Stop toolbar button. In the WFS console you can press the F5 key to start the workflow. Your workflow will start executing from the Workflow Start task. If you want to stop the workflow execution, you can click the Stop toolbar button. In the WFS console you can right click on any task in the workflow and select the "Run from Here" option. Your workflow will start executing from the selected task. Note: Using this feature can produce unexpected results as the tasks previous to the selected task may be outputting variables that are essential to the proper execution of the workflow from the selected task forward. Use this option with caution. On a computer with the WFS console installed, you can go to the command prompt and type WFStudio.exe -RunOnLoad="C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs". Doing this will cause the WFS console application to load the workflow file specified automatically, display the WFS console application, and immediately execute the workflow from the beginning. On a computer with the WFS console installed, you can go to the command prompt and type WFStudio.exe -Load="C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs". Doing this will cause the WFS console application to load the workflow file specified automatically and display the WFS console application. On a computer with the WFS console installed, you can go to the command prompt and type WFStudio.exe -Run="C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs". Doing this will cause the WFS console application to immediately execute the workflow file specified without displaying the WFS console application. On a computer with the WFS runtime installed, you can go to the command prompt and type WFStudio.exe -Run="C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs". Doing this will cause the WFS runtime application to immediately execute the workflow file specified. Since the WFS runtime component does not include the WFS console application the console application will not be displayed.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 34

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Alternatively to the previous bullet, you can leave off the -Run= portion of the command line statement. Doing so would leave WFStudio.exe "C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs". Additionally on a computer with the WFS runtime installed, you can execute multiple workflows in series by simply supplying multiple command-line parameters that each contain the full path to the workflow file (.wfs) you want to execute. For example, WFStudio.exe "C:\Documents and Settings\You\My Documents\Workflow Studio\My Workflow.wfs" "C:\Documents and Settings\You\My Documents\Workflow Studio\My Second Workflow.wfs". Each of the workflows will be executed and executed in the order in which they appear in the command line statement. You can have workflows executed by the WFS runtime or WFS console component at an end-user or administrator's request by simply setting up a shortcut icon on the user's desktop or start menu to run the workflow using some of the methods described above. Finally, you can use any task/job scheduling application you prefer to automate the execution of workflows. Some examples of supported applications/tools/systems you can use are: Windows Task Scheduler Microsoft System Center Operations Manager NetIQ AppManager Tidal Enterprise Scheduler

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 35

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Variables Storing data in a computer's memory is a fundamental necessity in creating any computer program. The same is true for workflows. Unlike traditional coding/scripting Workflow Studio makes it very easy to deal with variables, as you will see in a moment.

What Are Variables? A variable is simply a special name that represents some data. A variable might represent the string "John Doe", as we saw in the Creating Your First Workflow exercise. But a variable might also represent a number, such as 1024, a Boolean (True or False), or it can even represent an object. An object is a loosely-defined set of data. We will talk extensively about objects, specifically .NET objects, in the Understanding PowerShell and Workflow section. For now, however, we will ignore the complexities of objects and just focus on single entities of data such as strings, numbers, Booleans, etc.

The Syntax of Variables In Workflow Studio variables are uniquely defined. They are preceded by a dollar sign ($). Valid variable names must start with a dollar sign and must be followed by between one and 256 number alphanumeric characters.

The Special Variables There are also some special variables available to every workflow. These include all the system environment variables and a few additional special variables. These system environment variables are generated at workflow run time and include all of the variables that you see if you open a command prompt window and type the set command.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 36

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

These variables have a special syntax. Workflow Studio preserves the DOS-style %variable% format for these variables. For example, you can use the %SYSTEMDRIVE% variable in your workflow and its contents will be the drive letter of your system drive, such as C: There are also a few special workflow-related variables that are created at run time of each workflow.

Reserved Variable Description

$WorkflowStartDate The date of the execution of the workflow. The date is stored in the format dddd, MMMM dd, yyyy. For example, Wednesday, May 16, 2001.

$WorkflowStartTime The time of the execution of the workflow. The time is stored in the format h:mm:ss tt. For example, 3:02:15 AM.

$WFStudioDebuggingOn Contains a Boolean (True or False) indicating whether debugging has been enabled.

$WorkflowName A string containing the name of the current workflow. This is equivalent to the workflow file name, without the .wfs file extension.

$CurrentComputerName A string containing the name of the computer where the workflow is started.

$CurrentUserDomain A string containing the domain name of the user under whose credentials the workflow was started. If the user is not a domain user account, this variable will contain the same value as $CurrentComputerName.

$CurrentUserName A string containing the user name of the user under whose credentials the workflow was started.

$WFSVersion A string containing the version of Workflow Studio that is executing the current workflow.

How to use Variables Almost every task has one or more properties. Each one of these string properties can be supplied with a variable value. This allows workflows to be highly dynamic in nature and not require user input or lots of complex workflow logic. Some tasks also have specific Input Object properties. These properties appear when an input variable is required. The property is a string type property so you can enter anything you like but if you don't enter the name of an existing variable that contains the type of data the task is expecting the task will throw an exception. Let's look at a few simple examples: Take a look at the User Input task. This task allows the user to input data interactively with the workflow. This task has a Message property. This property displays a text message to the user on the input form. You could enter the following for the Message property: Enter your email alias (alias@$CurrentUserDomain.com)

If the domain name that the computer is in is called frameworkx, The message displayed to the user would be: Enter your email alias ([email protected])

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 37

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

You can concatenate multiple variables together as well. For example, you could have a workflow that has two User Input tasks and a message box as shown below.

One task asking for the user's first name and outputs $FirstName

And another task asking for their last name and outputs $LastName

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 38

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

The last task would be a Message Box task that displays "Your name is $FirstName $LastName"

When the workflow is started the first User Input task will execute displaying the following input window

And then the second User Input task will execute displaying the following input window

And finally the Message Box task will execute displaying the following dialog window

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 39

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Generally speaking tasks will either consume or produce variables that represent data for the purpose of manipulating that data. Therefore, various tasks in the workflow will need access to different variables. Therefore, variables are globally stored and can be accessed by any task in the workflow. Because of this, however, there are some considerations to keep in mind when creating your workflow: • Because workflows can contain simultaneously executing branches, it is possible to have more than one task modifying the same variable at the same time. If this occurs the results of the workflow may be unexpected. • When providing an input variable to a task, be sure to understand whether or not the data that the variable represents wi ll be modified by that task. Inputting that same variable to subsequent tasks might yield unexpected results if you do not expect the previous task(s) to have altered the variable contents. • You need to keep the usage of variable names straight within a workflow. Don't reuse a variable name unless you intentionally want/need to do so. Reusing variable names can cause variable data to be overwritten which will produce unexpected results from your workflow. • Don't reuse any of the reserved variables names listed above. Variables are globally accessible to any task in a workflow. Variables are not linearly passed from one task to another. While the name of the variable you chose is not technically important, it is important to choose variable names that are representative of the data they represent. Failing to do so will cause your workflows to be difficult to debug and very difficult for others to understand. As described above you can concatenate variables with other text and even other variables. For example, assume you have a variable called $Component (singular) and its value is set to printer. The variable string $Components (plural) will evaluate to printers. However, if you also define a variable called $Components (the same plural form) in another task and its value becomes telephone then when you reference $Components you will always be returned the value telephone even when you expect printers.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 40

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Conditions

Conditions and Sub-Tasks Before we go into conditions, I want to reiterate how conditions and sub-tasks are displayed When a task has an Execute Condition configured there will be a circle with the letter C

When a task has a Sub-Task configured there will be a circle with the letter S

When a task has both an Execute Condition and a Sub-Task configured both symbols will displayed

A Sub-Task is a task or set of tasks that are part of its parent Task

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 41

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Condition Property Almost every task has an Execute Condition property (under the Common property group). Other special tasks such as the While and If/Then/Else workflow control tasks have an If Condition property (under the Behavior property group). These two special "condition" properties allow you to define a conditional statement that will direct affect the behavior of the tasks in your workflow.

In the case of the Execute Condition If the condition expression you specify evaluates to True the task will execute normally (same as if you don't specify an Execution Condition at all). Conversely, if the Execute Condition expression you specify evaluates to False the task will not be executed and instead the next task in line (assuming there is one) will be given the workflow execution. When the Execute Condition is True, the condition indicator will turn green

When the Execute Condition is False, the condition indicator will turn red

The special If Condition properties are similar to Execution Conditions except that the tasks where the If Condition exists behave slightly differently to the evaluation results.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 42

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

In the case of the While task If the If Condition logic evaluates to True the sub-tasks underneath the While task will be executed, and when the sub-tasks have completed the If Condition is re-evaluated. If the If Condition re-evaluates to True again, the sub-tasks will be executed again. This continues until the If Condition evaluates to False. When the If Condition evaluates to False the sub-tasks are no longer executed and instead the task connected to the output connector of the While task (assuming there is one) is given the workflow execution.

In the case of the If/Then/Else task The If/Then/Else task has a slightly different use for the If Condition property. If the If Condition property evaluates to True the If/Then/Else task will give the workflow execution to the task that is connected to the left output connector. If the If Condition evaluates to False the If/Then/Else task will give the workflow execution to the task that is connected to the right output connector.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 43

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Operators Task conditions allow you to specify a single comparison operator. WFS supports PowerShell operators as well as traditional operators for simplicity. Here are some of the Comparison operators that you can use:

Operator Description

-eq Equal To

=

==

-ne Not Equal To

<>

!=

-gt Greater Than

>

-lt Less Than

<

-ge Greater Than or Equal To

>=

-le Less Than or Equal To

<=

$true True

-contains Contains

-notcontains Does Not Contain

-like Is Like

-notlike Is Not Like

-regex Matches a Regular Expression

-noregex Does Not Match a Regular Expression

Here are some Condition Examples: $PerfCounter -gt 90 $UserInput -le 25 $BatchOutput -contains "Failed" $UserInput -regex "[a-zA-Z0-9 ]*denied[a-zA-Z0-9 ]*" $Var

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 44

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Comparison operators

-eq Equal (case insensitive)

-ne Not equal (case insensitive)

-ge Greater than or equal (case insensitive)

-gt Greater than (case insensitive)

-lt Less than (case insensitive)

-le Less than or equal (case insensitive)

-like Wildcard comparison (case insensitive)

-notlike Wildcard comparison (case insensitive)

-match Regular expression comparison (case insensitive)

-notmatch Regular expression comparison (case insensitive)

-replace Replace operator (case insensitive)

-contains Containment operator (case insensitive)

-notcontains Containment operator (case insensitive)

-ieq Case insensitive equal

-ine Case insensitive not equal

-ige Case insensitive greater than or equal

-igt Case insensitive greater than

-ile Case insensitive less than or equal

-ilt Case insensitive less than

-ilike Case insensitive equal

-inotlike Case insensitive equal

-imatch Case insensitive regular expression comparison

-inotmatch Case insensitive regular expression comparison

-ireplace Case insensitive replace operator

-icontains Case insensitive containment operator

-inotcontains Case insensitive containment operator

-ceq Equal (case sensitive)

-cne Not equal (case sensitive)

-cge Greater than or equal (case sensitive)

-cgt Greater than (case sensitive)

-clt Less than (case sensitive)

-cle Less than or equal (case sensitive)

-clike Wildcard comparison (case sensitive)

-cnotlike Wildcard comparison (case sensitive)

-cmatch Regular expression comparison (case sensitive)

-cnotmatch Regular expression comparison (case sensitive)

-creplace Replace operator (case sensitive)

-ccontains Containment operator (case sensitive)

-cnotcontains Containment operator (case sensitive)

-is Is of a type

-isnot Is not of a type

-as Is a type, no error if conversion fails

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 45

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Assignment operators

= Assignment

+= Increment by value and Assignment

-= Decrement by value and Assignment

*= Multiply by value and Assignment

/= Divide by value and Assignment

%= Modulo by value and Assignment

Logical operators

-and Logical And

-or Logical Or

Bitwise operators

-band Bitwise and

-bor Bitwise or

Redirection Operators

2>&1 Add errors to results

1>&2 Add results to errors

>> Append results to a file

> Create a file with results, previous file contents are overwritten

< Input from (not supported)

2>> Append errors to a file

2> Errors from operation are directed to named file, previous file contents are overwritten

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 46

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Debugging Debugging a workflow in Workflow Studio can be performed in many ways. In fact, most people will find their own preference for how to debug a workflow. But if you are not familiar with debugging software code or Workflow Studio workflows, the following descriptions and instructions will prove invaluable to you. First, let's look at the most common causes for bugs in your workflow: Incorrectly configured tasks Incorrectly ordered tasks Incorrect task condition expressions Missing or incorrect assumptions about systems or other external devices that the workflow is accessing Insufficient security privileges Workflow Studio typically includes enough information about how your workflow ran for you to debug it. Unlike debugging in C++ or C#, you will not step though your workflow one task at a time, but rather, run the workflow and then analyze the saved information after the run is complete. Each task has a set of properties under the Run Results group. These properties include:

Last Error A text message displaying the error that occurred after the last time this task was run. If no error occurred, this property should display, "No Exception". Last Exception The exception that was thrown during the last time this task was run. If a task encounters an exception this property will include a text message of the exception encountered. If no exception is thrown, this property should contain the text "No Exception". Run Result The result after this task was run. Valid values include: Inactive A task will have an Inactive result if its Active property is set to False. Succeeded A task will have a Succeeded result if it ran successfully without errors. Condition Failed A task will have a Condition Failed result if its Condition property is not empty and if that condition returns False, causing the task to be skipped. Error A task will have an Error result if it throws an exception while running. Time Completed The time that the task to complete its duties. Workflow Variables After The entire list of workflow variables exactly as they were passed to this task after the task was run. Note that this property will only be filled out if the Workflow -> Debugging On option is selected. Workflow Variables Before The entire list of workflow variables exactly as they were passed to this task before the task was run. Note that this property will only be filled out if the Workflow -> Debugging On option is selected.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 47

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Before a workflow is run, all tasks appear blue indicating a "reset" state, and the six properties listed above will be empty or contain their default values. If you have already run your workflow and want to "reset" the workflow you can do so by pressing CTRL-F5. Once the workflow is run, each task will take on a color that indicates its Run Result. The color legend shown below: Executing When a task is executing it will blink Yellow

Success When a task successfully executes, it will turn green

Condition When an Execute Condition is True, the condition indicator will turn green

When an Execute Condition is False, the condition indicator will turn red

Error When a task encounters a problem executing it will turn red

Selected When you select a task, the selected task will be turn orange

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 48

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Inactive When you elect to disable a task the task will be turned gray

Inactive Last Run When a workflow is executed a disabled task will be turned dark grey

To find an error in your workflow, you can typically just look for a red task (indicating that that task threw an exception), select it, and look at its Last Error property. If this is not enough information to determine what went wrong, look at the Workflow Variables Before property to make sure that the parameters/values you were expecting were passed to that task (Workflow -> Debugging On must be selected in order for this property to contain any information). Note: That these Run Result properties will only contain information about the last time a task ran. This can be a problem if you have a looping structure in your workflow and want information about what happened in the task each time through the loop. To get this information, you can look at the output pane at the bottom of the Workflow Studio console. This pane contains a history of the order in which the tasks ran, each task's Run Result, and any error messages that occurred for each task. As such, it will contain information about every time a task was run, not just the last time. It is worth mentioning that turning on the Workflow -> Debugging On option tends to consume significantly more memory because Workflow Studio creates two complete copies of the all the Workflow variables in memory for every task in your workflow, and it does so every time you run the workflow. This is why the option is turned off by default. Only turn this option on when you need the information it provides (it provides the data for the Workflow Variables Before and Workflow Variables After properties in each task).

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 49

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Error Handling In all but the simplest workflows errors (or exceptions) can occur. As your workflow creation needs and skills grow you will almost certainly encounter exception conditions caused by some tasks failing for some reason. This document does not explain how to debug those exceptions but it will show you how to create intelligent workflows very easily by using a few features that ship with Workflow Studio.

Catch Exception Task First, there is a Catch Exception task (in the Workflow Control folder). This task is designed to be placed in a workflow after (in order of task execution) the tasks in your workflow that are likely to encounter an exception. When a preceding task encounters an exception the Catch Exception task will immediately assume the workflow execution and if the exception is of the type specified in the Exception Type property the workflow execution will be directed through the left output connector of the Catch Exception task. From there you can have some workflow logic that deals with the exception condition (such as send an email to an administrator, log an event to the Event Log, etc.).

Additionally, the exception message will be stored in the variable you supply in the Exception Variable property, so you can include that exception message in tasks that follow the Catch Exception task's left output connector.

If the workflow does not encounter an exception but instead the normal workflow execution path encounters the Catch Exception task, the workflow path will proceed through the right output connector unobstructed (i.e. the Catch Exception task performs no action in this situation).

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 50

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

You may want to consider having multiple Catch Exception tasks in your workflow at varying points within the workflow in order to handle different exceptions differently. Specific guidance cannot be given here as every workflow is different but if you think about where exceptions are most likely to occur and consider whether you need to handle the exceptions differently depending on the reason for each exception, you will know whether you need multiple Catch Exception tasks. If an exception is encountered on a task and the Catch Exception task in the workflow is beyond a task that has multiple output connectors, Workflow Studio will pass the workflow execution through the left output connector of the multi-output task. The example workflow image shows this behavior:

Also note, however, that if the *only* Catch Exception task is on the right output connector of a preceding multi-output task (the If/Then/Else task in the example workflow above), the workflow execution will pass through the right output connector and go directly to the Catch Exception task, as you would expect.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 51

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Stop on Error Property Just about every task has a Stop on Error property in the Common property group. This property is set to True by default for all new tasks as they are added to the design surface.

With the default value of True if the task encounters an exception the workflow will stop at that task. The exception information will be logged to the output pane and, if configured via the Workflow Log Error Events logging option, to the Windows Event Log. If a Catch Exception task exists after the task that encountered the error, however, the workflow will proceed directly to that Catch Exception task as described above.

If the Stop on Error property is set to False and the task encounters an error, the error will still be logged to the output pane and, if configured via the Task Log Error Events logging option, to the Windows Event Log, but the workflow will not stop executing at that task. Instead, the workflow will simply proceed on to the next task in the workflow. Even if a Catch Exception task exists after the task that encountered an exception, if the Stop on Error property is set to False that Catch Exception task will not receive the workflow execution as is described above (when the Stop on Error property is set to True).

Note: Give careful consideration to the Stop on Error property setting if you expect your workflows to run in an unattended mode, and especially without using the logging capabilities of the Workflow End task. If you set the Stop on Error property to False and run a workflow in an unattended session the workflow may produce unexpected results and you will have no way to determine what happened.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 52

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Run Result Variable Every task has a Run Result Variable property in the Common property group. This property allows you to set the Run Result string for the selected task to a variable of your choice. This can be used by subsequent tasks to alter the workflow execution path or for other means you deem appropriate. You can use this property to manually handle an exception using, for example, an If/Then/Else task. Consider the following simple example:

The above workflow asks the user to enter the name of a running process on their computer. That name is passed into the Process Name Filter property of the Get-Process task. The Get-Process task's Stop on Error property is set to False. The Get-Process task's Run Result Variable is set to $GetProcessRR.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 53

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

The If/Then/Else task's If Condition property is set to $GetProcessRR -eq "Error".

The left Message Box task's Message Text property is set to Could not get the process information. The right Message Box task's Message Text property is set to Found the $GetProcessOutput.Name process. When the workflow is run and the user enters the name of a process that exists on the system, the Get-Process task will get that process's object data and will proceed to pass the workflow execution to the If/Then/Else task... no exception was encountered. However, if the user enters a process name that does not exist on the system, an exception will be thrown by the Get-Process task. However, since the Stop on Error property is set to False the Run Result Variable will be set to the Run Result text, "Error" in this case. Next, the If/Then/Else task evaluates the expression and that returns True so the output is directed to the left Message Box which tells us that the workflow could not get the process information. This is a manual form of error handling. As you can imagine, there are many other error handling options/techniques available to you. The above is just one example.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 54

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Task Library The Citrix Workflow Studio

TM (WFS) product helps you quickly and easily automate data center and business processes by workflow-enabling Windows PowerShell.

Using a graphical user interface, you can design workflows that fully automate the following IT processes: User account management Server and application provisioning Security enforcement Disaster recovery Routine and emergency maintenance on data center resources Out of the box WFS provides the building blocks you need to build the automation you want. WFS allows you to use building blocks, called tasks, and create workflows that automate daily support and maintenance tasks. For example, you can create workflows that automate the following activities: Resetting user passwords Provisioning a new servers Executing general diagnostic tasks Here are some of the out of the box tasks you can use in your workflows:

Active Directory Tasks

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 55

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Citrix NetScalar

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 56

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Citrix Provisioning Server

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 57

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Citrix XenServer

Group Policy Tasks

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 58

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Input/Output Tasks

Messaging Tasks

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 59

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Windows Tasks

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 60

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Windows PowerShell Tasks

Workflow Control Tasks

Workflow Function Tasks

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 61

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Workflow and Powershell Windows PowerShell is a new interactive command line shell and scripting language, built on top of the Microsoft .NET Framework. PowerShell is a highly advanced shell and scripting language that is revolutionizing the way IT administrators think about application and system management. Workflow Studio significantly reduces the learning curve for PowerShell while simultaneously enhancing productivity by using PowerShell "under the covers". Without Workflow Studio IT administrators have to learn the complex PowerShell language and syntax in order to get any benefit from the PowerShell platform. With Workflow Studio IT administrators simply have to drag and drop objects onto a design surface and "draw" their process tasks visually in order to automate routine processes. In order to get the most out of Workflow Studio however, you need to understand a few basic PowerShell concepts. These include .NET objects, very basic PowerShell syntax, and the concept of "piping" objects between PowerShell CMDLETS

.NET Objects In software development/programming terms, an object is like a black box that contains zero or more "things". Those things are, of course, some sort of data that is in memory on the computer. The object may contain text, number, Boolean, or other types of data. Furthermore, an object may contain a combination of any number of these types of data. .NET objects take things one step further. A .NET object can be a "live" object that represents actual entities of your computer, your network, or other aspects of your computing environment. For example, a .NET object can represent a service running on your computer, a user account in Active Directory, or a file on the hard drive on a remote computer. And not only does the .NET object represent those entities, they object can (and almost always does) expose to you methods which you can execute against those entities to manipulate or perform some function against. For example, you might want to instruct the .NET object that represents a service running on your computer to stop. .NET objects are at the heart of PowerShell. The PowerShell tasks that ship with Workflow Studio either take a .NET object as an input (optionally in most cases), output a .NET object, or both. And what no other application that integrates with Windows PowerShell on the market today can do Workflow Studio allows you to access and manipulate those .NET objects outside of the context of PowerShell explicitly. For example, you can use the For Each Object task to enumerate through a list of service objects in a .NET object and allow the user to pick and chose which services to stop, one at a time, all without writing any code. Note: Sometimes .NET objects are referred to PowerShell objects, or PSObjects, when referring to those .NET objects that are consumed or produced by a PowerShell CMDLET or script.

PowerShell Syntax Because of the tight integration of Workflow Studio with PowerShell, some of the PowerShell syntax shows up in the Workflow S tudio UI. The following list details the instances of PowerShell syntax in the Workflow Studio user interface: Variables follow the PowerShell variable syntax ($variable) Conditional statement operands can use the PowerShell syntax

Piping Objects When using the PowerShell command shell you will find yourself often "piping" .NET objects between PowerShell cmdlets. One example is using the Get-Process CMDLET and piping its output to the Sort-Object CMDLET to sort the list of processes running on your computer and then piping that sorted list to the ConvertTo-Html cmdlet to convert the .NET object to HTML and then pipe that text to the Set-Content cmdlet to write the results to an HTML file. Here is the PowerShell command you would need to sort the currently running processes on your computer by each processes name: PS > Get-Process * | Sort-Object -property Name | ConvertTo-Html * | Set-Content processes.html In Workflow Studio, you simply need to drop the Get-Process, Sort-Object, and Export to XML tasks to the design surface, connect them together in that order, set the Sort-Object task's Property to Name and set the Export to XML task's Output XML File property to the name of the file you want created (c:\temp\processes.html). Finally, you need to set the Input Object variable to use the Output Object variable of the preceding task for the Sort-Object and Export to XML tasks.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 62

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

The resulting workflow looks like this:

Clearly this is much simpler to construct but this is already a simple PowerShell example. The more complex the PowerShell command the simpler it is to use Workflow Studio to achieve the same results. Another aspect to consider when thinking about piping objects between CMDLET tasks is that you don't have to pass one tasks output to the next subsequent task in the workflow. The objects are globally accessible by any task in the workflow, so you can have lots of other process automation logic in between any/all of these CMDLET tasks just by simple dragging and dropping them into the right order and dragging the input/output connectors together. No more learning syntax, reading reference guides, etc. Welcome to the world of PowerShell for the non-developer.

Workflow Studio Variables Workflow Studio contains global variables, called workflow variables that can be added to, or retrieved by, any task in a workflow. These variables take the $VAR form. These variables are the way Workflow Studio allows you to pipe the output of one task to the input of another task. This applies to PowerShell and non-PowerShell tasks alike. Both the PowerShell Script and PowerShell Command tasks have an ‘Input Variable' and ‘Output Variable' property. The ‘Input Variable' property is simply piped into the command or script to be executed. The ‘Output Variable' property is a bit more complicated and requires an understanding of the PowerShell Runspaces which are described next.

Workflow Studio PowerShell Global Runspace In addition to workflow variables, Workflow Studio also contains a global PowerShell Runspace. That global Runspace is used by all PowerShell tasks to save and retrieve variables created by a PowerShell script or command. These Runspace variables are not part of the workflow variables set because they live within the Runspace. In the "Working with PowerShell Runspace and Workflow Variables" section below we will explore how to access the Runspace variables from non-PowerShell tasks by using the Set-Variable CMDLET to set a variable in the workflow variables set equal to the value of a PowerShell Runspace variable. Before we leave the concept of PowerShell Runspaces it is important to note that most of the PowerShell tasks have a ‘Use Separate Runspace' property that indicates whether to use the global Runspace or its own Runspace. The default is to use the global Runspace so that any variables created in the Runspace will be available to other PowerShell tasks. Since only one task can run in that Runspace at any given time, you can have a PowerShell task use its own Runspace if: 1) you need to run PowerShell tasks in parallel, and 2) those PowerShell tasks don't need to retrieve, create, or change any global Runspace variables.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 63

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Working with PowerShell Runspace and Workflow Variables The command below entered into the ‘PowerShell Command' property creates a Runspace variable called $MyProgram. $MyProgram = "Workflow Studio" All the command above did was add a variable called $MyProgram to the PowerShell Runspace and assign it a value of "Workflow Studio". It did not assign anything to the ‘Output Variable' property. It is the ‘Output Variable' property that needs to contain the data that we want use in other tasks. If you were to modify the above command by removing the Runspace variable assignment ($MyProgram) you would be left with simply: "Workflow Studio" which will not create a Runspace variable but will assign the string to the workflow variable specified in the ‘Output Variab le' property. If our ‘Output Variable' property was $MyString, we now have a $MyString workflow variable that can be used by another task. You can also write PowerShell Script tasks that output multiple runspace variables and add a workflow variable as well. If you place this filter into the PowerShell Script task's ‘Filters and Functions' property, filter StringFilter { $FirstString = "The first one" $SecondString = "The second" Set-Variable -name MyString -value ($FirstString) -passthru -scope global -option AllScope } and call that filter in the task's ‘PowerShell Script' property (StringFilter), then Workflow Studio will add a runspace variable called MyString and a workflow variable with the name of the value of the task's ‘Output Variable" property. The -passthru switch on the Set-Variable command is mandatory to add the variable to the workflow variables. You can have multiple Set-Variable commands in a script to create multiple Runspace variables, but only the last Set-Variable with -passthru switch will be sent as output from the script into the variable specified by the ‘Output Variable' property. A Set-Variable command with the -passthru switch is the only way to get a single variable into the Workflow Studio workflow variables so it can be used by all other workflow tasks ( even non-PowerShell tasks). If you want variables in the ‘Filters and Functions' property to be automatically added to the PowerShell Runspace when the filter/function is executed you do not have to use the Set-Variable command in the filter/function. You can "dot reference" the filter/function in the ‘PowerShell Script' property by adding a period followed by a string in front of the filter/function name. Using the previous example, our ‘PowerShell Script' property would have a value of . StringFilter. In this case any variable (like $FirstString and $SecondString) created in the filter/function becomes Runspace variables. This means that they can be accessed by other filters or functions or by the ‘PowerShell Script' code directly. Finally, if you want to retrieve a Runspace variable and place it in the workflow variables you can do that in a script like this: filter CreateWorkflowVariable { Set-Variable -name MyString -value ($var) -passthru -scope global -option AllScope } Once you define this filter, simply call the CreateWorkflowVariable filter from the ‘PowerShell Script' property. WFS runs on top of Windows PowerShell. This allows you to leverage the power of Windows PowerShell while using the WFS graphical user interface. The WFS graphical user interface helps you quickly and easily create and automatically run workflows. These workflows can automatically perform the complex series of disjointed and disconnected tasks you currently must perform manually in order to maintain your IT environment.

Introducing the Citrix Workflow Studio Partner Tech Preview By Rich Crusco @ Frameworkx.com

P a g e | 64

Introducing Citrix Workflow Studio Rich Crusco – Frameworkx.com

Citrix Workflow Studio Composer You have been given a in depth preview of how Citrix Workflow Studio unlocks the potential in Microsoft PowerShell and the Windows Workflow Foundation, by providing an easy to use, graphical interface for workflow composition that virtually eliminates scripting. Workflow Studio is pre-populated with task libraries that interface with all Citrix products, Citrix-ready solutions and 3rd party offerings, providing out of the box capabilities to drive provisioning, configuration and other management functions in an automated fashion.

Citrix Workflow Studio out of the box provides the building blocks you need to build the automation you want by leveraging its interfaces with Microsoft Powershell, API Calls, CLI Modules, Web Services, 3rd Party Plug-Ins, Citrix Ready Products, Citrix Delivery Center Products, and 3rd Party Infrastructure Products. This ability is complimented by its ability to also leverage it's the use of existing scripts that may exist through the use of scripting tasks, for Example:

Citrix Workflow Studio helps you quickly and easily automate data center and business processes by workflow-enabling them for you.

Conclusion By now you must be as excited as I am about Citrix Workflow Studio, and are probably asking where and when can I get a copy for my own evaluation. Citrix is currently working releasing the Citrix Workflow Studio – Customer Tech Preview Stay Tuned here for further preview and release information: http://www.citrix.com/English/ps2/products/product.asp?contentID=1297816 Check here for further details and other information: http://community.citrix.com/display/cdn/Citrix+Workflow+Studio