PowerShell Script Module to Get Lun Information for a Particular Pattern Search for LUN Name

Here's a custom PowerShell Script Module Using PS ToolKit to extract Lun Information for a Particular InitiatorGroup Name & Lunid.

 

function Get-NalUNMapping {

<#

.DESCRIPTION

Gets Lun Information for a Particular Pattern Search for LUN Name

.EXAMPLE

Import-Module NaLUNbyMap

Get-NalunMapping

Get-NalunMapping | Export-Csv "FilerInfo.csv"

Get-NalunMapping -nlun "vol_DemoCCRN1"

Get-NalunMapping -nlun "vol_DemoCCRN1" | Export-Csv "FilerInfo.csv"

#>

 

 

[CmdletBinding()]

param(

                    [Parameter(Mandatory=$false,ValueFromPipeline=$True,HelpMessage="Pattern Search for LUN Name")]

                    $nlun="/vol/"

           )

 

$info1= 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}} | ? {$_.lun -match $nlun}

 

 

Return $info1

}

 

 

I can also pipe the output of this cmdlet to "Export-CSV" to extract the data in a csv format.

 


Comments

can we just get lun name instead of the entire path

could you please attach the module also or else pls refer the link to download