Combining output of two Cmdlets to get a common output

跟風遠走 提交于 2019-12-11 04:31:06

问题


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 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.



来源:https://stackoverflow.com/questions/7021326/combining-output-of-two-cmdlets-to-get-a-common-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!