Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

The Group Object....

$
0
0

Ok, so I want to know how to better utilize the group object... I'm using Netapp cmdlets so most of you will not be able to relate, but I have a list of volumes with policies assigned to them.

 

Looks like this

get-ncvol -vserver vserver1 | select Vserver,Name,Junctionpath,@{n='policy';e={($_.volumeexportattributes).policy}} | group -property policy

 

So I need to group it by policy, b/c I want to create a query and update volumes on the DR side with the proper policy...

So an update-ncvol query looks something like this

$volumes = @( @{Name=”vol1”;Vserver=”vs_1”}, @{Name=”vol2”;Vserver=”vs_1”}, @{Name=”vol3”;Vserver=”vs_2”} )
$volumes | % { Update-NcVol –Query $_ -Attributes @{ VolumeExportAttributes=@{Policy=”my_policy”}} }
  

 

But i'm having trouble pulling the two together to make it look like $volumes variable...

I was Hoping group would be able to solve it. 


Viewing all articles
Browse latest Browse all 6937

Trending Articles