Lifecycle Manager Reports made Excel Friendly

Have you ever tried opening a VMware Lifecycle Manager (LCM) report.xml file with Excel? Probably didn't have much luck, right? The following brief tutorial will walk you through the steps necessary to make these reports generate XML files that can be opened by Excel (Disclaimer: I did my tests with Excel 2007.) Please click the Read More link to see the rest of this article.

Finding the Report Workflows and Editing them

To get started, you will need to launch your vCenter Orchestrator Client. Once you have logged into the vCO client and connected to your LCM server, perform the following steps:

  1. Click the "Workflows" section in the left pane
  2. Expand out to: Applications -> Lifecycle Manager -> Report -> Report workflows
    Workflow Tree
  3. Select the Report you wish to modify
  4. Right-Click on the report and select "Export" so that you can have a backup copy of the workflow
  5. Now, right-click and select Edit
  6. Once you are in Edit mode, click on the "Schema" tab in the right pane and select the "Generate report file in xml" Scriptable Task (the middle rectangle)
    Editing a workflow
  7. Now click the "Scripting" tab in the bottom of the window
  8. Select all the contents of that Scripting box and delete them.
  9. Now, Copy the following and paste it into that box:
     /* Begin custom code to replace the standard Generate XML Report File scripting contents */
    
    var document = XMLManager.newDocument();
    var workbook = document.createElement("Workbook");
    workbook.setAttribute("xmlns","urn:schemas-microsoft-com:office:spreadsheet");
    workbook.setAttribute("xmlns:o","urn:schemas-microsoft-com:office:office");
    workbook.setAttribute("xmlns:x","urn:schemas-microsoft-com:office:excel");
    workbook.setAttribute("xmlns:ss","urn:schemas-microsoft-com:office:spreadsheet");
    workbook.setAttribute("xmlns:html","http://www.w3.org/TR/REC-html40");
    document.appendChild(workbook);
    
    var worksheet=document.createElement("Worksheet");
    worksheet.setAttribute("ss:Name","report.csv");
    workbook.appendChild(worksheet);
    
    table = document.createElement("Table");
    // Setup Column Headers:
    System.log("Setting up column headers");
    if(props.length > 0){
    var row = document.createElement("Row");
    for each (key in props[0].keys){
    cell = document.createElement("Cell");
    data = document.createElement("Data");
    data.setAttribute("ss:Type", "String");
    try {
    System.log("Key: "+key.toString());
    data.textContent=key.toString();
    } catch(e) {
    System.debug(e);
    }
    cell.appendChild(data);
    row.appendChild(cell);
    }
    table.appendChild(row);
    }
    
    for(var i in props){
    var keys = props[i].keys;
    System.log(keys);
    var row = document.createElement("Row");
    for(var j in keys){
    //System.log(keys[j]);
    cell = document.createElement("Cell");
    data = document.createElement("Data");
    data.setAttribute("ss:Type", "String");
    try {
    data.textContent=props[i].get(keys[j]).toString();
    } catch(e) {
    System.debug(e);
    }
    cell.appendChild(data);
    row.appendChild(cell);
    }
    table.appendChild(row);
    }
    
    worksheet.appendChild(table);
    
    XMLManager.saveDocument(document, System.getTempDirectory()+"report.xml");
    resultFile = new MimeAttachment(System.getTempDirectory()+"report.xml");
    
    /* End custom Generate XML Report File code */
  10. In the bottom-right corner, click "Save and Close" (NOTE: It is recommended that you Increment the version number prior to save and close)
  11. Now go login to your LCM webview and run the report you chose (I chose the All Events) report for my example here
    All Events Report in LCM
  12. Once you have executed the report, click the "Download" button to download the report.xml file
    Open report with Excel
  13. Now Open the report.xml file with Excel
    Raw XML Report in Excel
  14. Adjust Column Widths as needed and maybe BOLD the first row as that row contains the column headers
    Formatted Report in Excel

As you can see from the screenshot above, Column Headers are automatically generated and the appropriate data is shown in each column. You may now use Excel to re-order/hide columns, sort, etc.

WARNING: Changing Core workflows as outlined above is not supported by VMware. So, if you make these changes and the report stops working, then it's on you to fix. Best fix would be to DELETE the broken workflow, Highlight the "Report Workflows" Category in the vCO client, and then IMPORT your backup copy of the core Report Workflow.

NUC Lab Kit

Below are my thoughts for a vSAN nuc lab. Since I already have cables, not including them here. I ordered (and received by Nov 30, 2016)
3 x nuc, 3 x 32GB Crucial mem, 3 x Toshiba NVMe drive, 3 x Startech USB to GB NIC, and 3 x Crucial 1TB SSD. I've also been very happy with my Cisco SG300-10 so I bought one more since my existing one only has one port available. Each of the items listed here are linked below - all were purchased using the provided links below.
single NIC (See this post for details on using the USB -> GB NIC item listed below

I stayed with the i5 for the power consumption and form factor vs. the i7 Skull Canyon ;)

 

Search

Experts Exchange