A gem to simplify interaction with VMServer.

Let’s see how to configure and use the gem. Place all your configuartion in the initialize block. Now interacting with VMServer should be a piece of cake :)

vmserver = VMServer.new do |vm|
  vm.host             = 'https://xx.xx.xx.xx:8333/sdk'
  vm.vm_user          = 'root'
  vm.vm_password      = 'xxxxxxxx'
  vm.guest_password   = 'xxxxxxxxxx'
  vm.guest_user       = 'administrator'
  vm.datastore        = '[standard] img/img.vmx'
  vm.logging_enabled  = true
end

To start the VMServer

vmserver.start

To stop the VMServer

vmserver.stop

You can also do a hard stop which is equivalent of plugging of the system physically bc. vmserver.stop(‘hard’)

To create a directory in the Guest OS

vmserver.mkdir('dir')

Example

vmserver.mkdir('c:\test folder\vm server')

To copy a file from Host OS to Guest OS

vmserver.copy_file_from_host_to_guest('src','dest')

Note The src and dest need to be absolute paths.

To list the files under a directory

vmserver.ls('dir')

This will return an array of files

To remove a directory in the Guest OS

vmserver.rmdir('dir')

To remove a file in the Guest OS

vmserver.rmfile('file')

Example

vmserver.rmdir('c:\exampledir')

To run a program in the guest OS

vmserver.run_program_in_guest('path_to_prog',:prog_args => 'if any')

To list processes in guest

vmserver.get_processes_in_guest

This will return an array of processes along with their PIDs

To kill a process in guest

vmserver.kill_process_in_guest('pid')

To take a snapshot of the guest OS

vmserver.capture_screen('path_to_output_file_on_host')