0

I want to Power Off a VM, I am able to connect to vm using ConnectToVMWareVIServer method of VIX but I am getting error on when I try to Open the connection. I am getting an exception Failed to open Virtaul machine.. with inner exception "One of the paramters was invalid"

I am new to VMWare hence I used the c# code mentioned in https://github.com/dblock/vmwaretasks

using (VMWareVirtualHost virtualHost = new VMWareVirtualHost())
                {
                    // connect to a remove (VMWare ESX) virtual machine
                    virtualHost.ConnectToVMWareVIServer(vmIPAddress, vmUserID, vmPassword);
                    // open an existing virtual machine
                    using (VMWareVirtualMachine virtualMachine = virtualHost.Open(vmVMXPath))
                    {
                        // power on this virtual machine
                        virtualMachine.PowerOff();
                        // wait for VMWare Tools
                    }
                }
  • You have 3 parameters that you can get wrong. Make sure that isn't the problem by doing this first from the desktop. https://www.youtube.com/watch?v=3ZHGSqvwSQw – Hans Passant Mar 26 '19 at 14:17
  • @HansPassant : I am able to connect using connecttoVMWareVIServer. But error occurs on virtaulHost.Open(vmVMXPath). – TechnoCoder Mar 27 '19 at 08:30

0 Answers0