Monday, February 18, 2013

Snapshot reporting


Following script can be used to generate a report on snapshots on the virtual platform . Report will export Virtual Machine Name , snapshot size , the name given while creating the snapshot and the created date . 




Before running the script we need to connect to the VC server using Connect-VIServer.

Result of get-vm



PowerState              : PoweredOn
Version                 : v9
Description             : Test machine
Notes                   : Test machine
Guest                   : TestingServer:Microsoft Windows Server 2003 Standard (32-bit)
NumCpu                  : 1
MemoryMB                : 2048
MemoryGB                : 2
HardDisks               : {Hard disk 1, Hard disk 2}
NetworkAdapters         : {Network adapter 1}
UsbDevices              : {}
CDDrives                : {CD/DVD drive 1}
FloppyDrives            : ESXhost.domain.com
HostId                  : HostSystem-host-123
VMHostId                : HostSystem-host-123
VMHost                  : ESXhost.domain.com
VApp                    : 
FolderId                : Folder-group-v9
Folder                  : Discovered virtual machine
ResourcePoolId          : ResourcePool-resgroup-223
ResourcePool            : Development
PersistentId            : 501dee04-20f2-ec80-a40e-4619b33a9dd2
UsedSpaceGB             : 26.416720500215888023376464844
ProvisionedSpaceGB      : 26.416720500215888023376464844
DatastoreIdList         : {Datastore-datastore-230}
HARestartPriority       : ClusterRestartPriority
HAIsolationResponse     : AsSpecifiedByCluster
DrsAutomationLevel      : AsSpecifiedByCluster
VMSwapfilePolicy        : Inherit
VMResourceConfiguration : CpuShares:Normal/1000 MemShares:Normal/10240
Name                    : TestingServer
CustomFields            : {}
ExtensionData           : VMware.Vim.VirtualMachine
Id                      : VirtualMachine-vm-102
Uid                     : /VIServer=adm@vcserver:443/VirtualMachine=VirtualMachine-vm-102/


Result Snapshot size includes - 

  1. .vmdk files - delta files stating the diff between the current state of disk and the state that existed when snapshot was taken.
  2. -delta.vmdk file => Raw data of disk
  3. .vmsd - snapshot information file. Used fir snapshot manager
  4. .vmsn - active mem state while taking snapshot



Get-snapshot retrieves virtual machine snapshot information from vCenter.



2 comments:

  1. Excellent script, can you help me to add which user has created the snapshot.

    Cheers
    Raj

    ReplyDelete
    Replies
    1. Hi Raj ,

      You can use the following script to track who created the snapshot .

      http://vmware-powercli.blogspot.in/2013/02/virtual-platform-change-history.html

      Delete