Unable to point the VM in vmware activities to rename a VM

I was trying to rename a VM from an ESXi host and when i enter the VM name in the Virtual machine field under Input for renameVM activity i’m getting the below error. The vm name was given in quotes eg: "VM name"

Argument ‘VirtualMachine’: cannot implicitly convert type ‘string’ to ‘UIpath.vmware.virtualmachineinfo’

Hi @selwin.s

Could you maybe provide a small screenshot of how you have it configured? :slight_smile:

Nevermind, I checked that activity and it actually requires a VM variable rather than a simple string with its name, see below:
image

If you create a variable by using CTRL+K when your cursor has a focus on this property, it will create the right variable with the right type:

You could then provide this variable as an output of the Get VM activity, where you can fetch your VM by an actual string name or string Id :slight_smile:

I hope it helps.

2 Likes

Thank you @loginerror and where can I give the value for the virtualmachineinfo variable. When i debugged i got an error as

Rename VM: An error has occurred: value cannot be null.
Parameter name: VirtualMachine

As I’ve mentioned before, you should use the Get VM activity first to get your VM, and only then use the Rename VM activity.

The Get VM activity takes either the name or an id of your VM as a string input :slight_smile:

1 Like

But what if I want to pass the following IP 10.XX.XX.153 into the Host input field of Deploy OVF Template activity and i’m facing the below error.

Argument host cannot implicitly convert type ‘string’ to uipath.vmware.contracts.host

Then there are other activities that allow you to grab this data.

The minimum would look like this (you grab your resources, output them to a variable and then use those variables in the Deploy OVF Template activity):



i will try this but why there are few inputs which always throws type conversion error. where can i find the appropriate input format for vmware activities

The best way for those is to create the variable directly from the property input:

  1. First click into the property to focus on it
  2. Then do CTRL + K (or right click → Create Variable) to create a variable
  3. Give it a name and press Enter

You will now have the variable for specific field of the right type.

You can also hover your mouse over the name of the property which will then tell you if the required property is a string (you can input it directly) or a specific type that needs to be taken from somewhere else (typically another activity).

The activities in general are based on the APIs of each service and follow those APIs’ structure, so the variable types are required to store all elements of specific entity, such as a VM or a Host.

1 Like

Thank you @loginerror. How can i print the output of Get host activity?

You can print out things with the Write Line activity or Log Message activity:

The auto complete after you type a dot should give you hints about the available properties.

Hosts.Id and .Name worked like a charm except Hosts.PowerState

I have a datacenter named myDatacenter in vCenter and it has 2 esxi hosts. How can i pass the values for folder input of Deploy OVF template activity which gives me an error Unable to find folder "TestFolder"

my vCenter gui

UIpath

To print a non-string value in a write line you should use
host.PowerState.ToString

Alternatively, enter a debug session with the Step Into option, then continue stepping into until you reach your Get Host activity (you can also just set a breakpoint for that).

After you Step Into one more time and the Get Host activity executes, check out the Locals panel for the output of this activity. You will be able to drill down into all it’s properties.

Got it @loginerror and everything is working now. I have a clarification that is, it is possible to use vmware activities without the usage of vCenter server?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.