Hi,
I am looking for script that would list RDMs which are only Perennially Reserved equals true for a specific cluster
Please help
-Madhu
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
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
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
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
Hi LucD,
Thanks a lot for your help. As always, you are simply superb