c# - Automate VM Workstation -


i trying automate vmware workstation, function need implements are:

  1. get vm names
  2. stop vm
  3. start vm

technology

i using vmware workstation 12 , .net 2013 (c#)

what have done after adding vestris.vmwarelib.dll reference:

vmwarevirtualhost virtualhost = new vmwarevirtualhost(); // connect local (vmware workstation) virtual machine virtualhost.connecttovmwareworkstation(); // open existing virtual machine //vmwarevirtualmachine virtualmachine = virtualhost.open(@"c:\virtual  machines\xp\xp.vmx");  vmwarevirtualmachine virtualmachine =  virtualhost.open(@"c:\users\tabish.mateen\documents\virtual machines\windows  7 x64\windows 7 x64.vmx");   // power on virtual machine virtualmachine.poweron(); // wait tools launch virtualmachine.waitfortoolsinguest(); // login virtual machine virtualmachine.logininguest("administrator", "password"); // run notepad virtualmachine.runprograminguest("notepad.exe", string.empty); // create new snapshot string name = "new snapshot"; // take snapshot @ current state virtualmachine.snapshots.createsnapshot(name, "test snapshot"); // power off virtualmachine.poweroff(); // find newly created snapshot vmwaresnapshot snapshot = virtualmachine.snapshots.getnamedsnapshot(name); // revert new snapshot snapshot.reverttosnapshot(); // delete snapshot snapshot.removesnapshot(); 

i getting error on second line when trying connect work station.

exception

an unhandled exception of type 'system.exception' occurred in vestris.vmwarelib.dll

additional information: failed connect: serviceprovidertype="workstation" hostname="" hostport=0 username="" timeout=60

inner exception

retrieving com class factory component clsid {6874e949-7186-4308-a1b9-d55a91f60728} failed due following error: 80040154 class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)).


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -