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
Is this a vSphere environment, and are you thinking about a PowerCLI script?
Yes i am looking for vmware power cli script.
how to check specific Datastore how many vm snapshot holding?
I have asked the moderators to move your post.
Hi,
Please help with script, if anything we can get information about snapshot in specific DS (vsphere environment).
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
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 '|'
})
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LUCD,
Thanks you so much, it is working fine to me.