VMware {code} Community
grassman80bz
Enthusiast
Enthusiast

create a Table with disk Name

Good morning,
I am trying to make a table, via powercli, of this type.

esxname - model cache disk - model capacity disk - model capacity disk - model cache disk - model capacity disk - model capacity disk - model capacity disk

The Model are in my case like SSDSC2KB019T8R, MZ7LH1T9HMLT0D3, MZ7LM1T9HMJP0D3, ecc...

I would like to have for each esx all the info on one row, so that I can easily notice mismatches.
Unfortunately, I can't at the moment.

I was trying this way, actually for just the cache disks for an esx (I wanted in the first instance to decrease the complexity):

 

 

$hst = Get-VMHost -name "*n59*"

foreach ($hst in Get-VMHost -name "*n59*"){
    foreach ($disk in ($hst | Get-scsilun -LunType disk -CanonicalName naa*)){
        write-host $disk.name
        $vmhost = get-VMHost $hst    
        $esxcli = get-esxcli -vmhost $vmhost -v2 #Gain access to ESXCLI on the host
        $esxcliargs = $esxcli.storage.core.device.list.CreateArgs()
        $esxcliargs.DiskName = $disk.CanonicalName
        $out = $esxcli.storage.core.device.list.Invoke($esxcliargs) #|Where-Object Vendor -like "ATA" | Select-Object Model | Select-String -NotMatch "DELLBOSS VD"
        $new = New-Object -TypeName psobject -Property @{Cluster=$hst.Parent; HOST=$hst.Name;Disk=$esxcliargs.DiskName; Model=$esxcliargs.model}
        $all += $new
    }
}
$allout = $all

 

 

 

Can anyone who can help me?
thanks

 

Reply
0 Kudos
0 Replies