VMware Cloud Community
collin_p
Contributor
Contributor

VRO Invoke External Script Code is not editable

I am not able to edit this code from the "invoke external script" in VRO.  I want to edit the code so I can pass a parameter into my powershell script.  See the code below.

Background. I have a self-service catalog item in Aria Automation so end-users can request and provision their own Vm's in vcenter.  I have several post-provision tasks that I need to run after the server is created that require me to import powershell modules.  Unfortunately, I couldn't do this in VRA.  I worked with support to try to package powershell modules but the proxy powershell host in VRA is linux so it just wouldn't work.  So now I'm passing the newly created servername variable from VRA into VRO via a subscription to an "invoke external script".  This is perfect because it invokes the script from a powershell host that has all of the powershell modules pre-loaded.  Now I need to take that server name variable from the newly created VM from VRA and pass it to the external powershell script to be invoked.  So it should look like this "c:\temp\PowerShellScript1.ps1 ServerName".   How would I do this since I can't edit the invoke script code?  Perhaps there is a way to do this without code.  The InputProperties.resourceNames[0] is the variable that captures the server name from VRA.  I was able to do a write-host from a scriptable task in VRO to see that the server name is being passed properly.

Thank you

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());
    }
}
Reply
0 Kudos
1 Reply
imtrinity94_2
Contributor
Contributor

If it is just about not able to modify the script inside the Invoke External Script WF in vRO, then I think the solution would be to duplicate the WF (as library Wfs are not editable) using the DUPLICATE button in the UI itself.

I am hoping this is what you asked.

Reply
0 Kudos