inderraw
Contributor
Contributor

Snapshots holding by particular data store

Hi Team mate,

Please help with VMware script, where i can get detail, one specific Data store holding how many snapshot?

required: it would easy to trace if any DS about to full, so we can check that ds only using script.

Regards

Inder Singh Rawat

 

0 Kudos
5 Replies
scott28tt
VMware Employee
VMware Employee

Is this a vSphere environment, and are you thinking about a PowerCLI script?

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
inderraw
Contributor
Contributor

Yes i am looking for vmware power cli script.

how to check specific Datastore how many vm snapshot holding?

Tags (1)
0 Kudos
scott28tt
VMware Employee
VMware Employee

I have asked the moderators to move your post.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
inderraw
Contributor
Contributor

Hi,

Please help with script, if anything we can get information about snapshot in  specific DS (vsphere environment).

0 Kudos
LucD
Leadership
Leadership

You mean something like this?

Get-Datastore -PipelineVariable ds |
ForEach-Object -Process {
  $snap = Get-VM -Datastore $ds | Get-Snapshot

  New-Object -TypeName PSObject -Property ([ordered]@{
    Datastore = $ds.Name
    SnapshotCount = $snap.Count
    SnapshotSize = [math]::Round(($snap | Measure-Object -Property SizeMB -Sum).Sum,1)
  })
}


if you want to look at a specific datastore, specify the name

Get-Datastore -Name MyDS -PipelineVariable ds |
ForEach-Object -Process {
  $snap = Get-VM -Datastore $ds | Get-Snapshot

  New-Object -TypeName PSObject -Property ([ordered]@{
    Datastore = $ds.Name
    SnapshotCount = $snap.Count
    SnapshotSize = [math]::Round(($snap | Measure-Object -Property SizeMB -Sum).Sum,1)
  })
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos