UCSD - Case Sensitive / Insensitive VM Name Search Example

Version 1
    Task Name

    Example on how to serach with RedEx for VM name case insensitive.



    1. Tested on 6.0
    ComponentsvSphere 5.x
    User Inputs

    Instructions for Regular Workflow Use:

    1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
    2. Unzip the file on your computer. Should end up with a .WFD file.
    3. Log in to UCS Director as a user that has "system-admin" privileges.
    4. Navigate to "Policies-->Orchestration" and click on "Import".
    5. Click "Browse" and navigate to the location on your computer where the .WFDX file resides. Choose the .WFDX file and click "Open".
    6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
    7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
    8. Click "Submit".
    9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment


    A big thank you goes to Alejandro Madurga Ainoza for the inspiration.


    The workflow:


    Screen Shot 2016-09-20 at 11.57.14 AM.png


    Workflow run and input and output:


    Screen Shot 2016-09-20 at 11.57.08 AM.png


    Workflow task inputs:


    Screen Shot 2016-09-20 at 11.57.24 AM.png



    Custom task code:










    var realvmname ='';



    function getReport(reportContext, reportName){

         var report = null;


                     report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);



         if (report == null)


             return ctxt.getAPI().getTabularReport(reportName, reportContext);


                else {

                var source = report.getSourceReport();

                       return ctxt.getAPI().getTabularReport (source, reportContext);




    function getReportView(reportContext, reportName){

         var report = getReport(reportContext, reportName);

         if (report == null)


               logger.addError("No such report exists for the specified context "+reportName);

               return null;


         return new TableView(report);




    function accessReports(filter){




              var repContext = util.createContextByType( "Global",null,null);

              var report = getReportView(repContext, reportName);




    logger.addInfo("RowCount Before filter : " + report.rowCount());


    logger.addInfo("Filtering VMs")


    // true means reg ex filter

    // Example:  (?i)PRD-TU-01

    // will find the vmname PRD-tu-01


    var filtered_report = report.filterRowsByColumn("VM Name", filter, true);

    logger.addInfo("Total VMs after filtering: "+ String(filtered_report.rowCount()));



    var ActualVMName =  filtered_report.getColumnValue(0, "VM Name");

    logger.addInfo("Actual VM Name: "+ ActualVMName);



    realvmname = ActualVMName;



    return  filtered_report.rowCount();






    var filter = String(input.RegExFilter + input.VMName);

    //var filter = "(?i)PRD-tu-01";

    logger.addInfo("User Input:"+ filter)

    var out = accessReports(filter);


    output.VMsFound = out;

    output.ActualVMName = realvmname;