Combining output of two Cmdlets to get a common ou

2019-08-02 07:25发布

I wanted to extract a filerview from Net App commandlets, i wrote a an expression below

Get-NaLun | Select @{Name="LUN";Expression={$_.path}},@{Name="Size";Expression=     {[math]::Round([decimal]$_.size/1gb,0)}},`
@{Name="OnlineStatus";Expression={$_.online}},`
@{Name="Group";Expression={([string]::Join(",",(Get-NaLun $_.path | get-nalunmap | select -ExpandProperty initiatorgroupname)))}},`
@{Name="LunID";Expression={Get-NaLun $_.path | get-nalunmap | select -ExpandProperty lunid}} | Export-Csv "c:\LUN_FilerView.csv"

What i wanted is it possible to search based on the LUN ID, Initiator Group Name

if i can get a cmdlet

  1. I would also like to run “Get-NaLUNbyMap” with a specific igroup map and LUN ID and have it respond with the LUN that is mapped at that LUN ID
  2. Get-naLunByMap –igroup SEAPSQLPWS1_Cluster_Nodes – LunID 7

Can some one help me thanks!

here is the output of

PS 103 >  Get-NaLun /vol/Co4_I_UserDB

Path                                      TotalSize Protocol     Online Mapped  Thin  Comment
----                                      --------- --------     ------ ------  ----  -------
/vol/Co4_I_UserDB   100.0 GB windows_2008  True   True   True  TEST - Authoring UserDBs

PS 104 >  Get-NaLunmap /vol/Co4_I_UserDB


InitiatorGroupName            : IA
InitiatorGroupType            : iscsi
Initiators                    : {i, iqn.1991-05.com.microsoft:}
InitiatorGroupOsType          : windows
InitiatorGroupPortsetName     :
InitiatorGroupThrottleBorrow  : False
InitiatorGroupThrottleReserve : 0
InitiatorGroupUsePartner      :
InitiatorGroupAluaEnabled     : False
InitiatorGroupVsaEnabled      : False
LunId                         : 14

1条回答
你好瞎i
2楼-- · 2019-08-02 07:50

I think the Get-NaLunByIgroup cmdlet built in to the DataONTAP PowerShell Toolkit is what you are looking for:

PS C:\> Get-NaLunByIgroup xyratex 1

Path                                      TotalSize Protocol     Online Mapped  Thin  Comment
----                                      --------- --------     ------ ------  ----  -------
/vol/nicholsondev2k8/lun                    80.0 GB windows_2008  True   True   True

Also, you might take a look at Get-NaHostDisk and/or Get-NaHyperV for mapping Windows disks back to NetApp storage.

查看更多
登录 后发表回答