Hello readers. I thought it would be a good idea to quickly discuss a topic that came up during a recent Runbook development effort. I was faced with the challenge of how to do the following:
- Provide an easy way to request data from an end user
- Make it familiar and intuitive
- Provide the data in a format that could be easily consumed by Orchestrator via PowerShell.
I opted for a quick and dirty Excel XML file. Looks exactly like an EXCEL XLS file but based on XML data format. The benefits from this approach were two fold. I didn’t have to program a fancy front end interface (more on this in a future blog post however ), and PowerShell could consume this data and immediately turn it into Published Data for the Runbook processing within Orchestrator.
So where do you start? Start with a basic Excel XML file. The easiest thing to do is put columns together as shown below that frame up what you are looking to gather. Highlights can be leveraged as shown to call attention to required data. In addition, you can even put in some data validation (three letters required, etc.) as well as “hover text” to provide your end user the ability to review helpful tips as they are filling out the required data.
Now that you have a basic template file put together, you can either have the user drop it into a pre-determined (monitored by Orchestrator) input directory and allow automation to pick up this file and appropriately process it. Or what we did was attach it to a service ticket (in our case Team Foundation Server) and allow Orchestrator to collect up that file from the ticket, process the data inside, and act accordingly (updating the ticket along the way of progress).
So far so good right? Next, once you have an idea of where you are going to place the file for processing, leverage a simple Run.NET object within Orchestrator to process the file according to cell and row analysis. The code snippit below basically sets variables in PowerShell according to text values located within the called out row and cell. Then you set returned data within your Runbook to the PowerShell variables.
Example: line 9 below evaluates $table.Row.Cell.Data."#text"
The value shown in row(1) and cell(1) is “SEC”. In contract row(0) cell(1) is “Values”. So for each row and cell combination you have with data you need, you will set to an appropriate variable that you can leverage within your Runbook inside Orchestrator.
Last and final step is to set Published Data within your Runbook to the variable data you have set in your Run.NET object.
That’s it! I’ve provided an example input file and PowerShell script for you to review and play around with. If you have any questions – as always please don’t hesitate to ask! Thanks for stopping by and till next time, Happy Automating!
Process XML Example Files Process-XML.zip