Hi Donny & Gidi,
Many thanks for chipping in and helping out. Much appreciated.
@Donny: I used the command you suggested in the following script: It will be interactive, i.e it will ask user to input the 'days older than snaps' in integer and depending on that it will produce result.
Its working fine without aggr field, my intention is to get aggregte against the volume names.
I tried this, and it runs but never ends [goes in loop kinds] I had to kill it, but it produced the resutls in excel, however the aggregate colume puts all the aggregates in each cell instead of just one aggregate against a column name.
Any idea how can I get this fixed ?
Get-NcSnapshot | ForEach-Object {
$x = "" | Select @{Name="SnapName";Expression={$_.Name}},Created, Vserver, Volume, Total_GB, Cumulative_GB, Dependency, @{l="Aggregate";e={(Get-NcVol $_.Volume).Aggregate}}
$x.SnapName = $_.Name
$x.Created = $_.Created
$x.Vserver = $_.Vserver
$x.Volume = $_.Volume
$x.Total_GB = $_.Total
$x.Cumulative_GB = $_.Cumulative
$x.Dependency = $_.Dependency
$x.Total_GB = [Math]::Round($_.Total / 1GB, 2)
$x.Cumulative_GB = [Math]::Round($_.Cumulative / 1GB, 2)
$x
} | Where {$_.Created -lt (Get-Date).AddDays(-$value)} | Export-CSV -Path "C:\blah\blah\snaps.csv"