VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

list RDMs which are only Perennially Reserved equals true

Hi,

I am looking for script that would list RDMs which are only Perennially Reserved equals true for a specific cluster

Please help

-Madhu

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Perhaps next time specify your requirements in the beginning :smileygrin:

Try like this

$clusterName = 'Cluster1'

$luns = Get-Cluster -Name $clusterName | Get-VM |

    Get-HardDisk -DiskType RawPhysical,RawVirtual | select -ExpandProperty ScsiCanonicalName

$report = Get-Cluster -Name $clusterName | Get-VMHost | %{

    $esxcli = Get-EsxCli -VMHost $_ -V2

    $esxcli.storage.core.device.list.invoke() |

    where{($luns -contains $_.Device) -and $_.IsPerenniallyReserved} |

    Select @{N='VMHost';E={$esxcli.VMHost.Name}},Device,@{N='SizeGB';E={$_.Size/1KB}},

        @{N='LUN';E={($esxcli.storage.nmp.path.list.Invoke(@{'device'=$_.Device})).RuntimeName.Split(':')[-1].TrimStart('L')}},

        IsPerenniallyReserved

}

$report | Export-Csv report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

$clusterName = 'Cluster1'

$luns = Get-Cluster -Name $clusterName | Get-VM |

    Get-HardDisk -DiskType RawPhysical,RawVirtual | select -ExpandProperty ScsiCanonicalName

Get-Cluster -Name $clusterName | Get-VMHost | %{

    $esxcli = Get-EsxCli -VMHost $_ -V2

    $esxcli.storage.core.device.list.invoke() |

    where{($luns -contains $_.Device) -and $_.IsPerenniallyReserved} |

    Select @{N='VMHost';E={$esxcli.VMHost.Name}},Device

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

thanks for your reply.

How can i get the size, LUN ID and status as True

Example:

VMHost    Device              LUN ID  Size    Perennially Status

ESX01      naa.1234546    5          10       True

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Perhaps next time specify your requirements in the beginning :smileygrin:

Try like this

$clusterName = 'Cluster1'

$luns = Get-Cluster -Name $clusterName | Get-VM |

    Get-HardDisk -DiskType RawPhysical,RawVirtual | select -ExpandProperty ScsiCanonicalName

$report = Get-Cluster -Name $clusterName | Get-VMHost | %{

    $esxcli = Get-EsxCli -VMHost $_ -V2

    $esxcli.storage.core.device.list.invoke() |

    where{($luns -contains $_.Device) -and $_.IsPerenniallyReserved} |

    Select @{N='VMHost';E={$esxcli.VMHost.Name}},Device,@{N='SizeGB';E={$_.Size/1KB}},

        @{N='LUN';E={($esxcli.storage.nmp.path.list.Invoke(@{'device'=$_.Device})).RuntimeName.Split(':')[-1].TrimStart('L')}},

        IsPerenniallyReserved

}

$report | Export-Csv report.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

Thanks a lot for your help. As always, you are simply superb Smiley Happy

0 Kudos