Microsoft Virtualization Discussions

Get-NaSnapshotDelta

JSHACHER11
5,433 Views

Hi guys,

I am trying to list Delta of all snapshots in a volume

this doesn't work:

$snaps = Get-NaSnapshot -TargetName vol1

$snaps | foreach {Get-NaSnapshotDelta | ft -AutoSize}

neither does this:

foreach ($snap in $snaps) {Get-NaSnapshotDelta}

nor this:

foreach ($snap in $snaps) {Get-NaSnapshotDelta $snap}

(still asking for snapshot name)

any idea?

tnx

1 ACCEPTED SOLUTION

JGPSHNTAP
5,433 Views

Yes, we need to understand why you are trying to use snapshot delta in the first place..

Billyd, -

IMHO - Here is the way you should do it using the cmdlets from netapp

convertto-formattednumber ((get-navol vol0 | get-nasnapshot  | measure -property Total -sum).sum) data

size "0.0"

4.5 GB

You can you system.math .net functions, but yours should look something like this

[math]::round(((get-navol vol0 | get-nasnapshot | measure -property Total -sum).sum/1gb),2)

4.5

View solution in original post

5 REPLIES 5

billyd
5,433 Views

If you are looking for the sum of all of the snapshots in a volume give this a shot:

$v = get-nasnapshot -targetname <VOLUME NAME> | measure-object total -sum;[math]::truncate($v.sum / 1gb)

I'm not sure how to get it done without a variable.

JGPSHNTAP
5,434 Views

Yes, we need to understand why you are trying to use snapshot delta in the first place..

Billyd, -

IMHO - Here is the way you should do it using the cmdlets from netapp

convertto-formattednumber ((get-navol vol0 | get-nasnapshot  | measure -property Total -sum).sum) data

size "0.0"

4.5 GB

You can you system.math .net functions, but yours should look something like this

[math]::round(((get-navol vol0 | get-nasnapshot | measure -property Total -sum).sum/1gb),2)

4.5

billyd
5,433 Views

Thanks JGP - I didn't know about the convertto-formattednumber cmdlet.  Much better than what I was using.

JGPSHNTAP
5,433 Views

Yeah, it was written for the module so I figured I use it when I can..

If not, i use the .net math functions

JSHACHER11
5,433 Views

thanks guys!

Public