VMware Aria Automation Orchestrator

 View Only
  • 1.  Pass parameters into an external script

    Posted Sep 07, 2023 08:15 PM

    I have duplicated the "invoke an external script" script in VRO and modified it so that it can receive the serverName from my VRA blueprint when a user does a self-service catalog request for a VM from the Service Broker in VRA.  Now the fun part.  I have post-config powershell scripts sitting on my VRO designated Powershell host.  This host has all of my powershell modules installed on it.  Here is my question.  I can execute scripts on the designated powershell host, no problem, but I want to be able pass the serverName parameter from the blueprint to these scripts.  

    In the code below there is a host.opensession() which will connect to my designated powershell host and run scripts.  So it will run c:\scripts\testscript.ps1 no problem.  But I want to be able to run 'c:\scripts\testscript.ps1 serverName' and pass the serverName parameter to the script so that I can run post-config scripts against this newly created server from the designated powershell host that has all of my powershell modules already installed.  I would think I would need to modify this code:   var script =  '& "' + externalScript + '" ' + arguments to pass the serverName parameter to it somehow.  Is this possible?

    var resourceNames = inputProperties.resourceNames

    var serverName = resourceNames[0]

    System.log("VM Name : " + serverName);

    var output;
    var session;
    try {
        session = host.openSession();
        var script =  '& "' + externalScript + '" ' + arguments;
        output = System.getModule("com.vmware.library.powershell").invokeScript(host,script,session.getSessionId()) ;
    finally {
        if (session){
            host.closeSession(session.getSessionId());
        }
    }


  • 2.  RE: Pass parameters into an external script

    Posted Sep 07, 2023 09:31 PM

    I was able to get the answer for this from another post titled "A simple way to pass multiple arguments to standalone vRO"