Pesquisar este blog

terça-feira, 20 de setembro de 2016

Multiplataform Hyper-V Manager using Python and FreeRDP

HYPY - HYper-v in PYthon

Multiplataform Hyper-V Manager using Python and FreeRDP

How HYPY works?

Hypy uses winrm to comunicate with hyper-v server shell and sends powershell commands to interact with the virtual machines. Using Powershell, HYPY can get Name, ID and state of virtual machines. Therefore, HYPY call freeRDP with vm-id and credentials, using settings in .conf file to connect the vm.




Hypy uses winrm to communicate with the hyper-v host, so it must be enabled and accepting connections. has a session explaining how to Enable WinRM on the remote host.



FreeRDP binary must be in path (windows, linux and mac). Make sure FreeRDP is working before using hypy or it will not open the session to the virtual machine. If you are using Linux, you package manager should have freerdp avaiable or look into for install instructions.


To configure Hypy, change the file 'hypy.conf'
host = <server name in domain>
domain = <domain name>
user = <user name in server>
pass = <password>

cache_file = <name of cache file>
sync_interval = <interval in hours to make new cache file>
You must have write permissions to the path pointed by cache_file


If you don't know how to use hypy, you can use --help --help

  Multiplataform Hyper-V Manager using Python and FreeRDP

  --help  Show this message and exit.

  connect  Connect to virtual machine identified by...
  create   Create a new snapshot with vm's current state
  delete   Delete a machine's snapshot by name
  list     List virtual machines and its indexes
  pause    Pause virtual machine identified by index
  restore  Restore virtual machine snapshot
  resume   Resume (paused) virtual machine identified by...
  snaps    List virtual machine snapshots
  start    Start virtual machine identified by index
  stop     Stop virtual machine identified by index
If you need help on any subcommand, run COMMAND --help

Autor: Gabriel Avanzi.