Microsoft Virtualization Discussions

Get-NaVol -Aggregate

cguldelmco
3,743 Views

I am trying to list my Aggr/Volumes using

$allaggr = Get-NaAggr | sort -property name

foreach ($aggr in $allaggr) {

     $allvol = Get-NaVol -Aggregate $aggr | sort -property name

     foreach ($volume in $allvol) {

          write-host $aggr.name, $volume.name

     }

}

I get only a list of the Aggregates but no Volumes.

The WebDoc doesn't list the -Aggregate option but the get-help Get-Navol -Detailed does.

1 ACCEPTED SOLUTION

paleon
3,745 Views

Replace:

$allvol = Get-NaVol -Aggregate $aggr | sort -property name

with

$allvol = Get-NaVol -Aggregate $aggr.name | sort -property name

The -Aggregate flag is expecting a string with the aggregate name, not an aggregate object.

View solution in original post

2 REPLIES 2

paleon
3,746 Views

Replace:

$allvol = Get-NaVol -Aggregate $aggr | sort -property name

with

$allvol = Get-NaVol -Aggregate $aggr.name | sort -property name

The -Aggregate flag is expecting a string with the aggregate name, not an aggregate object.

cguldelmco
3,745 Views

Doh!

It was right in front of me.

Thanks

Public