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 -
- .vmdk files - delta files stating the diff between the current state of disk and the state that existed when snapshot was taken.
- -delta.vmdk file => Raw data of disk
- .vmsd - snapshot information file. Used fir snapshot manager
- .vmsn - active mem state while taking snapshot
Get-snapshot retrieves virtual machine snapshot information from vCenter.