25/06/19

Vim Quick Reference

Basically, vim has three working modes:

  1. Command mode
  2. Insert Mode
  3. Ex-mode

Basic VIM Movement

  • b move back from word
  • w move next to word

Commands

Disable text wrap

:set wrap!
(you can use ~/.vimrc)

Display or hide line numbers?

:set number
for display
:set nonumber
for hide

29/04/19

VMWARE - Get snapshots and size of VMs


Today I need to check the snapshots of all VMs of a VMware infrstructure. Unfortunately I have found that with vSphere Client and vSphere Web Client it's not possibile to get a list of snaps associated to VMs.

So, after a advanced google search, I have found that this is possibile using VMware PowerCLI tools.
I've installed the version 5.5 available in this page https://code.vmware.com/web/tool/5.5/vmware-powercli

After this, I use powershell for loading the snapin and connect to my vcenter server with this:

add-pssnapin vmware.vimautomation.core
connect-viserver myvcentersrv_FQDN


Then with the commmand I get the list with VM name, number of snapshot and size:

Get-VM | Format-Table Name, @{Label="NumSnapshots";Expression={(Get-Snapshot -VM $_ | Measure-Object).Count}}, @{Label="TotalSnapShotSizeMB";Expression={(Get-Snapshot -VM $_ | Measure-Object -Sum SizeMB).Sum}}

Ref: http://www.vhersey.com/2016/03/01/quick-powercli-to-get-snapshots-and-size/