NullReferenceException when trying to get VM List

Hi,
I’m quite new to UiPath and VM-Ware automation. To start, I wanted to get a list of all VMs on my test server. Unfortunately, I get a NullReferenceException when invoking the activity “Get VM List”. This error leaves me kinda helpless, as I don’t know, what to fix. The activity is located inside a VMware Scope and it should have credentials to an account with sufficient rights.

I also installed the certificate of our VCSA, but I’m still lost on this error.

These are the properties of both, the VmWare Scope and the Get VM List activity:

This is the setup of servers we have in our company:
VMwareServers

At this point, I suspect that the property “Folder” of the “Get VM List” activity is incorrect, but I don’t know which input would be correct. I’ve tried serveral permutations of our cluster setup, but with no success.

I’m lost here. Any help is highly appreciated.

Best Regards,
Christian

Hi @christian.sonntag !
Welcome to UiPath Community :smile:
I am not familiar with VM Ware Application Scope, but let’s try to look for the solution together !
Would you mind removing “@” form the username property, and try to run the code again ?
Also, it would be interesting to copy from clipboard the whole error message that is displayed so we can look for further references :grin:

Hi @Hiba_B,

removing the “@” from the username didn’t change anything. I’m using C# as my project language and the “@” sign allows me to use "" in my strings without having to escape them.

I’ve looked into the exception myself, but I didn’t get any useful information out of it. Anyways, here it is:

20.6.0-beta.93+Branch.release-v20.6.0.Sha.520fc7e20bd9baa56becf2fa30e75d1a9000a01d

Source: Get VM List

Message: An error has occurred: Object reference not set to an instance of an object.

Exception Type: UiPath.VMware.VMwareException

RemoteException wrapping UiPath.VMware.VMwareException: An error has occurred: Object 
reference not set to an instance of an object.  ---> RemoteException wrapping 
System.NullReferenceException: Object reference not set to an instance of an object. 
   at UiPath.VMware.VMClients.<DisposeAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at UiPath.VMware.VMwareService.<RunVMClientsAsync>d__8`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at UiPath.VMware.Activities.GetVMList.<ExecuteAsync>d__28.MoveNext()
--- End of inner exception stack trace ---
   at UiPath.VMware.Activities.BaseVMwareActivityWithResult`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hi @christian.sonntag !
Indeed if when you created the project you precised C# then @ can be kept :grin:
Ok I think too that the folder path may be different. Unfortunately no more details in the logs :confused: For the folder let’s try:
ERLBVCSA/Erl<…>/Z-Cluster
or
ERLBVCSA\Erl<…>\Z-Cluster

After testing, if it does not work, would you mind opening the eventlog in windows, in the application list, if you see an interesting error message, more detailed ?
image

In Event Viewer, I get two errors, one ist the Exception I also saw in UIPath and the other one seems to be releated to telemetry:

Ok thanks.
When you tried with both ways of writing the folder path, did you have the exact same error ?

Yes, both with “/” and "" did cause the exception

@Forum_Staff do you have an idea of how we should deal with the situation ?

The error above lists an older community version 20.6.0-beta.93, which in itself is a bug because community versions should auto-update to the latest one.

First suggestion would be to install the latest 21.4 version, see here:
How to fix your Studio installation / Licensing issues

1 Like

Hi @christian.sonntag
You are only providing Folder name.
Could you please try with full path of the folder which in this case will be something like “Erl***/Z-Cluster”.

Also, could you please tell the version of UiPath.VMware.Activities package which you are using.

Thanks

1 Like

Hi @Anshu_Kumar
I’ve tried the full path with “ERLBVSCA/Erl…/Z-Cluster” as well as “Erl…/Z-Cluster”, with both “/” and "". No improvement. I am using v. 1.1.4 of UiPath.VMware.Activities.

@loginerror
I’ve not yet had a chance to update to version 21.4, but I will do that later today

@christian.sonntag please change to the view indicated in the screenshot below and see there the folder structure you have for your datacenter.
image

Hi @ovidiuponoran,

in that view, the “Z-Cluster” entity is not shown:

What does that mean?

The activity asks as input for the Folder in-argument a value that doesn’t include hosts or clusters and looks like a folders full-path, starting from the Datacenter - example: “Datacenter1/Folder1/Subfolder”

This full-path is what you see when you expand nodes in the VMware vSphere - VMs & Folders view (the one from your latest screenshot).

As a helper, you can take a look at:

  1. VMware sample video that includes GetVMsList Automate VMWare Activities with UiPath - YouTube
  2. VWware sample workflow guide (skip to How to use, step 5.) IT Automation Activities for VMWare

In VMware Scope activity, ServerAddress should something like “ERLBVCSA.abc.com
In Get VM List the Folder = “Erl…/013-…”

You need to provide a virtual machine folder as displayed in that second view.

image

Okay, that did something. I changed the setting in the VMware Scope ERLBVCSA.. and the Folder to “Erl***\017-***”. That threw an exception stating it could not find the data center.

using “Erl***/017-****” ran a lot longer, but then also came back with this exception:

20.6.0-beta.93+Branch.release-v20.6.0.Sha.520fc7e20bd9baa56becf2fa30e75d1a9000a01d

Source: Get VM List

Message: Unable to retrieve Virtual Machines under "Erl***/017-****": VMware.Vim.VimException
   at VMware.Vim.ViewBase.SetViewData(ViewBase currentObject, String currentPropertyPath, Dictionary`2 allowedPropertyPath, Dictionary`2 objectContentList, Dictionary`2 generatedManagedObjectList)
   at VMware.Vim.ViewBase.UpdateViewData(String[] properties)
   at VMware.Vim.VimClientImpl.GetView(ManagedObjectReference moRef, String[] properties)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.CreateInfo(VirtualMachine vm, String fullPath, VapiClient vapiClient)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.<>c__DisplayClass2_0.<CreateInfos>b__0(VirtualMachine vm)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.CreateInfos(VirtualMachine[] vms, VapiClient vapiClient)
   at UiPath.VMware.Vim.Client.VimClient.<GetVMListAsync>d__23.MoveNext()

Exception Type: UiPath.VMware.VMwareException

RemoteException wrapping UiPath.VMware.VMwareException: Unable to retrieve Virtual Machines under "Erl***/017-****": VMware.Vim.VimException
   at VMware.Vim.ViewBase.SetViewData(ViewBase currentObject, String currentPropertyPath, Dictionary`2 allowedPropertyPath, Dictionary`2 objectContentList, Dictionary`2 generatedManagedObjectList)
   at VMware.Vim.ViewBase.UpdateViewData(String[] properties)
   at VMware.Vim.VimClientImpl.GetView(ManagedObjectReference moRef, String[] properties)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.CreateInfo(VirtualMachine vm, String fullPath, VapiClient vapiClient)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.<>c__DisplayClass2_0.<CreateInfos>b__0(VirtualMachine vm)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at UiPath.VMware.Vim.Extensions.VirtualMachineExtensions.CreateInfos(VirtualMachine[] vms, VapiClient vapiClient)
   at UiPath.VMware.Vim.Client.VimClient.<GetVMListAsync>d__23.MoveNext() 
   at UiPath.VMware.Activities.BaseVMwareActivityWithResult`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

The path should be specified as “Datacenter/folder1/folder2/…"

Try using Get VM and set a value for VirtualMachineName parameter (i.e. The full path of the virtual machine including the datacenter and folder). Does it work?

Make sure you had installed the trusted root CA certificates from your vSphere on the machine where the Robot is running. See documentation: https://docs.uipath.com/activities/docs/vmware-scope

Getting a VM by name also failed with this exception:

20.6.0-beta.93+Branch.release-v20.6.0.Sha.520fc7e20bd9baa56becf2fa30e75d1a9000a01d

Source: Get VM

Message: Unable to find Virtual Machine with name "Erl****/017-***/017_CISHMIPAx64"

Exception Type: UiPath.VMware.VMwareException

RemoteException wrapping UiPath.VMware.VMwareException: Unable to find Virtual Machine with name "Erl****/017-***/017_CISHMIPAx64" 
   at UiPath.VMware.Activities.BaseVMwareActivityWithResult`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

I’ve tried also the Get VM activity using the VMs ID 6ad66c42-901b-48b6-a644-6cb4ab847780 (which I think is correct, I got it from the URL of my V-Center):

It doesn’t matter that the VM is powered of, does it?

I have also installed the certificate, even re-installed it. I noticed that I only have one *.crt file instead of the two shown in the documentations GIF. Could that be an issue?

@christian.sonntag

I don’t know why you have only one certificate.
I’ve just tested in another environment where I had 3 certificates (*.crt files) to install.

BTW, in your screenshot, the VM id is “vm-8373”

In my test environment, I’ve created a similar folder structure with yours and everything works fine.
image

Using the id “vm-8373” also didn’t work.

These are the certificate files I download from out V-Center:
image