Skip to content

Instantly share code, notes, and snippets.

Created January 24, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1219033be14200e25dbe to your computer and use it in GitHub Desktop.
Save anonymous/1219033be14200e25dbe to your computer and use it in GitHub Desktop.
$vm = Get-VM "vnname"| select name,VMHost
$hdd = Get-HardDisk -VM "vmname" -DiskType RawPhysical| select Parent, Name, Filename, SCSICanonicalName, DeviceName
$Lun = Get-SCSILun $hdd.SCSICanonicalName -VMHost $vm.vmhost
$lunpaths=$lun|Get-ScsiLunPath
$luns = $lunpaths | select name, sanid, State, Preferred
$luns
$props = @{'VMName' = $hdd.parent -join ';'
'HDDName' = $hdd.name -join ';'
'FileName' = $hdd.filename -join ';'
'DeviceName' = $hdd.devicename -join ':'
'CanonicalName' = $hdd.scsicanonicalname -join';'
'Luns' = $luns – join ';' (don't know if this makes sense :))
or
'LunName' = $luns.name -join ';'
'SANId' = $luns.sanid -join ';'
'State' = $luns.sate -join ';'
'Preferred' = $luns.preferred -join';'
}
$obj = New-Object -TypeName PSObject -Property $props
#Write-Output $obj
$obj | Export-Csv vm.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment