Created
June 14, 2016 12:40
-
-
Save vMarkusK/ca6ef25dc7e3ca0b1d2548f6c7582c30 to your computer and use it in GitHub Desktop.
Checks ESXi LUNs that have to much Paths or Multiple LUN IDs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start of Settings | |
# Set the maximum number of paths per LUN | |
$MaxLUNPaths = 4 | |
# End of Settings | |
$myHosts = $VMH | where {$_.ConnectionState -eq "Connected" -and $_.PowerState -eq "PoweredOn"} | |
$Report = @() | |
foreach ($myHost in $myHosts) { | |
$esxcli2 = Get-ESXCLI -VMHost $myHost -V2 | |
$devices = $esxcli2.storage.core.path.list.invoke() | select Device -Unique | |
foreach ($device in $devices) { | |
$arguments = $esxcli2.storage.core.path.list.CreateArgs() | |
$arguments.device = $device.Device | |
$LUNs = $esxcli2.storage.core.path.list.Invoke($arguments) | |
$LUNReport = [PSCustomObject] @{ | |
HostName = $myHost.Name | |
Device = $device.Device | |
LUNPaths = $LUNs.Length | |
LUNIDs = $LUNs.LUN | Select-Object -Unique | |
} | |
$Report += $LUNReport | |
} | |
} | |
$Report | where {$_.LUNPaths -gt $MaxLUNPaths -or ($_.LUNIDs | measure).count -gt 1 } | |
$Title = "Check LUNs that have to much Paths or Multiple LUN IDs" | |
$Header = "LUNs not having more than ($MaxLUNPaths) Paths or Multiple LUN IDs: $(@($Report | where {$_.LUNPaths -gt $MaxLUNPaths -or ($_.LUNIDs | measure).count -gt 1 } ).count)" | |
$Comments = "Multiple LUN IDs are not Supported" | |
$Display = "Table" | |
$Author = "Markus Kraus" | |
$PluginVersion = 1.1 | |
$PluginCategory = "vSphere" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment