Get-HBAInfo (SAN): Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
K (Admin verschob die Seite HBA (SAN) nach Get-HBAInfo (SAN), ohne dabei eine Weiterleitung anzulegen)
 
(4 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
'''-> This function/script is moved to [https://github.com/R-Studio/PSTools GitHub]!'''<br>
  
 +
== Get-HBAInfo Function ==
 
<source lang="powershell">
 
<source lang="powershell">
 
function Get-HBAInfo {
 
function Get-HBAInfo {
Zeile 30: Zeile 32:
  
 
</source>
 
</source>
 +
 +
 +
== Show Number of HBA paths per LUN ==
 +
<source lang="powershell">(gwmi -Namespace root\wmi -Class mpio_disk_info).driveinfo | % {Write-host "Name: $($_.name) Paths: $($_.numberpaths)"} </source>
 +
 +
or
 +
 +
<source lang="powershell">
 +
(gwmi -Namespace root\wmi -Class mpio_disk_info).DriveInfo | Select @{N='DiskNumber';E={($_.Name -replace "(MPIO\sDisk)([0-9]*)" , '$2')}}, @{N='UniqueID';E={$_.SerialNumber}}, @{N='NumberOfPaths';E={$_.NumberPaths}}
 +
</source>
 +
  
  

Aktuelle Version vom 26. Februar 2020, 10:32 Uhr

-> This function/script is moved to GitHub!

Get-HBAInfo Function

function Get-HBAInfo {
   [CmdletBinding()]
   Param
   (
     [Parameter(Mandatory=$false, ValueFromPipeline=$true, Position=0)]
     $ComputerName
   )
 
   Begin {
      $Namespace = "root\WMI"
} Process {
     $port = Get-WmiObject -Class MSFC_FibrePortHBAAttributes -Namespace $Namespace @PSBoundParameters
     $hbas = Get-WmiObject -Class MSFC_FCAdapterHBAAttributes -Namespace $Namespace @PSBoundParameters
     $hbaProp = $hbas | Get-Member -MemberType Property, AliasProperty | Select -ExpandProperty name | ? {$_ -notlike "__*"}
     $hbas = $hbas | Select $hbaProp
     $hbas | %{ $_.NodeWWN = ((($_.NodeWWN) | % {"{0:x2}" -f $_}) -join ":").ToUpper() }
 
     ForEach($hba in $hbas) {
       Add-Member -MemberType NoteProperty -InputObject $hba -Name FabricName -Value (
        ($port |? { $_.instancename -eq $hba.instancename}).attributes | `
        Select `
        @{Name='Fabric Name';Expression={(($_.fabricname | % {"{0:x2}" -f $_}) -join ":").ToUpper()}}, `
        @{Name='Port WWN';Expression={(($_.PortWWN | % {"{0:x2}" -f $_}) -join ":").ToUpper()}} 
        ) -passThru
    }
  }
}


Show Number of HBA paths per LUN

(gwmi -Namespace root\wmi -Class mpio_disk_info).driveinfo | % {Write-host "Name: $($_.name) Paths: $($_.numberpaths)"}

or

(gwmi -Namespace root\wmi -Class mpio_disk_info).DriveInfo | Select @{N='DiskNumber';E={($_.Name -replace "(MPIO\sDisk)([0-9]*)" , '$2')}}, @{N='UniqueID';E={$_.SerialNumber}}, @{N='NumberOfPaths';E={$_.NumberPaths}}



Source: http://www.purepowershellguy.com/?p=54