Scanning the deadLun Path in Vcenter
# PowerShell script to check for VM snapshots and send Email report
add-pssnapin VMware.VimAutomation.Core
Connect-VIServer -Server 'vmwarediaryVcenter' -User 'vmwarediary\rahulJ' -Password 'abc@1234567'
ForEach ($vmhost in (Get-Datacenter | Get-Vmhost | Sort)){ $deadpaths = Get-ScsiLun -vmhost $vmhost | Get-ScsiLunPath | where {$_.State -eq "Dead"} | Select ScsiLun,State; Write-Host $vmhost
$deadpaths} ConvertTo-Html Host, Deadpaths | set-Content "c:\test.htm"
Result would be as below:
{ScsiLun=naa.30001440000000103039d8bac5ee8099; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8099; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8099; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8098; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee809b; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee7f37; State=Dead} @{ScsiLun=naa.30001440000000103039d8bac5ee8093; State=Dead}