VMware {code} Community
RULRUL
Contributor
Contributor

Perform Actions on a virtual host on esx server

Hello there

I try to connect to a virtual machine on an esx server. Creating a connection does work properly, but I can't perform anything on the virtualHost object!


This is how I create the connection:

VMWareVirtualHost virtualHost = new VMWareVirtualHost();

virtualHost.ConnectToVMWareVIServer(EsxServer, EsxUser, EsxPassword);


And now, whatever method or property I'm calling, for example:

List<VMWareVirtualMachine> vitualMachines = virtualHost.RegisteredVirtualMachines.ToList();

I end up getting this error:

System.Exception: Failed to get all registered virtual machines ---> System.Exception: Failed to open virtual machine: fileName="SREAT01/SREAT01.vmx" timeoutInSeconds=60 ---> Vestris.VMWareLib.VMWareException:

Insufficient permissions in the host operating system

   at Vestris.VMWareLib.VMWareInterop.Check(UInt64 errCode)

   at Vestris.VMWareLib.VMWareJob.Wait[T](Object[] properties)

   at Vestris.VMWareLib.VMWareJob.Wait[T](Object[] properties, Int32 index, Int32 timeoutInSeconds)

   at Vestris.VMWareLib.VMWareJob.Wait[T](Int32 propertyId, Int32 timeoutInSeconds)

   at Vestris.VMWareLib.VMWareVirtualHost.Open(String fileName, Int32 timeoutInSeconds)

   --- End of inner exception stack trace ---

   at Vestris.VMWareLib.VMWareVirtualHost.Open(String fileName, Int32 timeoutInSeconds)

   at Vestris.VMWareLib.VMWareVirtualHost.Open(String fileName)

   at Vestris.VMWareLib.VMWareVirtualHost.get_RegisteredVirtualMachines()

   --- End of inner exception stack trace ---

   at Vestris.VMWareLib.VMWareVirtualHost.get_RegisteredVirtualMachines()

   at TestAutomationTool.Program.Main(String[] args) in c:\*****\Program.cs:line 20

Additional information:

- The user, does have the administrator rights for this VM

- vSphere Client, Version 5.5.0 / Build 1993072
- VMware vCenter Server, Version 5.5.0 / Build 1750787

Now, how can I fix this?

I searched the internet from the bottom to the top and could not find a solution!

Thanks in advance.

Regards, RUL

Reply
0 Kudos
0 Replies