The string error you are seeing is because the UUID for local disks is shorter than the one for SAN disks.
Most of the time these local disks have the word "local" in the displayname.
So you could filter them out by replacing this
foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware"})
by
foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware" -and $_.DisplayName -notmatch "local"})
The empty DevicePath property is due to non-disk devices.
If I replaced this line
foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware"})
by this line
foreach ($Device in $VMHostObj.Config.StorageDevice.SCSILUN | Where-Object {$_.Vendor -ne "VMware" -and $_.LunType -eq "disk"})
that problem is gone.
Btw why do you test for vendor VMware ?
Is your set up running on a VMware Workstation perhaps ?
The complete script is attached.
____________
Blog: LucD notes
Twitter: lucd22