Automation

 View Only
  • 1.  Snapshots holding by particular data store

    Posted Jan 25, 2023 03:55 AM

    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

     



  • 2.  RE: Snapshots holding by particular data store

    Broadcom Employee
    Posted Jan 25, 2023 09:29 AM

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

     



  • 3.  RE: Snapshots holding by particular data store

    Posted Jan 27, 2023 03:13 AM

    Yes i am looking for vmware power cli script.

    how to check specific Datastore how many vm snapshot holding?



  • 4.  RE: Snapshots holding by particular data store

    Broadcom Employee
    Posted Jan 27, 2023 06:36 AM

    I have asked the moderators to move your post.

     



  • 5.  RE: Snapshots holding by particular data store

    Posted Jan 27, 2023 07:04 AM

    Hi,

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



  • 6.  RE: Snapshots holding by particular data store

    Posted Jan 27, 2023 12:47 PM

    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)
      })
    }


  • 7.  RE: Snapshots holding by particular data store

    Posted Jan 30, 2023 02:21 AM
      |   view attached

    Hi Mate,

    Thanks for your response, as checked it is showing count of snapshot specific DS, is it possible to know which vm holding snapshot in specific DS?

    attached specific DS, snapshot count.



  • 8.  RE: Snapshots holding by particular data store

    Posted Jan 30, 2023 07:51 AM

    You can add 1 property for that

    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)
        VM = $snap.VM.Name -join '|'
      })
    }


  • 9.  RE: Snapshots holding by particular data store

    Posted Jan 30, 2023 08:54 AM

    Hi LUCD,

    Thanks you so much, it is working fine to me.