Hello,
I want to change the VM name using a vRO workflow. I have put a script that has an "InputProperties" as input but it is impossible to change the name, even the subscription workflow has an OK status.
Does somebody has here an example to show ? How can you change values of the properties of the VM ?
Thanks for you help.
It is now solved. The subscription must have the blocking mode enabled in vRA, otherwise the script in the vRO workflow "Compute Allocation" doesn't change the properties.
As said by pizzle85, an input/output from the script AND the workflow must be set. Example :
Inputs : inputProperties - Properties
Outputs : resourceNames - Array/string
System.log("VM Name before : " + resourceNames[0]);
resourceNames[0] = "myNewName";
System.log("VM Name after : " + resourceNames[0]);
Not sure if this is what you are looking for, new to Automation. I was able to change the VM name based on user input, followed the information in this link:
https://www.stevenbright.com/2020/02/custom-hostname-generation-in-vrealize-automation-8/2/
The only issue I have now is it will generate a name that already exists in Virtual Center and fails. Struggling to figure out how to check if the generated name already exists. I find vcplugin examples but looks like that was taken out of version 8
In my blueprint i use the "name" field which will result in the VM being named <vmname>-something.
I have a workflow with a single script element.
Input: inputProperties properties
Output: resourceNames array/string
resourceNames = new Array()
var props = JSON.parse(JSON.stringify(inputProperties))
System.log(props.resourceNames)
var split = props.resourceNames[0].split('-')
split.pop()
split.pop()
resourceNames.push(split.join('-'))
It is now solved. The subscription must have the blocking mode enabled in vRA, otherwise the script in the vRO workflow "Compute Allocation" doesn't change the properties.
As said by pizzle85, an input/output from the script AND the workflow must be set. Example :
Inputs : inputProperties - Properties
Outputs : resourceNames - Array/string
System.log("VM Name before : " + resourceNames[0]);
resourceNames[0] = "myNewName";
System.log("VM Name after : " + resourceNames[0]);
This helped me . How do we update MAC, VLAN etc
Alternative for below in vRO8
virtualMachineAddOrUpdateProperties = new Properties ();
virtualMachineAddOrUpdateProperties.put('Name', hostname);
virtualMachineAddOrUpdateProperties.put('VirtualMachine.Network0.MacAddressType', 'static');
virtualMachineAddOrUpdateProperties.put('VirtualMachine.Network0.MacAddress', mac);
virtualMachineAddOrUpdateProperties.put('VirtualMachine.Network0.Name', "VLAN"+vlan);