oriolrius.cat

Des del 2000 compartiendo sobre…

Tag: command

Turn on virtual machines in VMWare ESXi

Reading time: < 1 minute Next commands are very useful when you don't have access to the vSphere UI and you have to access to VMWare Hypervisor using SSH or console:

# get the list of virtual machines
vim-cmd vmsvc/getallvms

# get the state of a VM with #id: VM_ID
vim-cmd vmsvc/power.getstate VM_ID

# turn on the virtual machine with #id: VM_ID
vim-cmd vmsvc/power.on VM_ID

Another option to turn on the virtual machine using an Ansible playbook:

- hosts: vmware
  gather_facts: false
  tasks:
    - vsphere_guest:
        vcenter_hostname: "X.X.X.X"
        username: "{{ hostvars[inventory_hostname].ansible_ssh_user|quote }}"
        password: "{{ hostvars[inventory_hostname].ansible_ssh_pass|quote }}"
        guest: "NAME_OF_THE_VM"
        state: "powered_on"
      delegate_to: localhost

equivalent de la comanda “grep” en windows: “find”

Reading time: < 1 minute

Si te hubiera conocido antes… m’he passat mitja vida usant el grep en linux i fins avui no he descobert que en windows existeix el find que serveix pel mateix. Per fi ja puc fer:

# netstat -an | grep ESTABLISHED

C:\>netstat -an | find "ESTABLISHED"