Hi,
I am getting the below error , please help.
Error
Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl] does not contain a method named 'op_Addition'.
At D:\RDM_Attach\New\2_Perennial_Reservation_RDM_CSV.ps1:34 char:2
+ $vmhost + " " + $rdm.Canonical_Name + " " + "IsPerenniallyReserved= ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Script
$esxis = get-cluster MyClus | get-vmhost
$in_csvpath = '.\1_Host_LUN_Mapping_Info.csv'
$rdmlist = Import-Csv -Path $in_csvpath
foreach ($vmhost in $esxis){
$myesxcli = Get-EsxCli -VMHost $vmhost
foreach ($rdm in $rdmlist)
{
$diskinfo = $myesxcli.storage.core.device.list($rdm.Canonical_Name) | Select -ExpandProperty IsPerenniallyReserved
$vmhost + " " + $rdm.Canonical_Name + " " + "IsPerenniallyReserved= " + $diskinfo
#$myesxcli.storage.core.device.setconfig($false,$rdm.Canonical_Name,$false)
if($diskinfo -eq "false")
{
write-host "Configuring Perennial Reservation for LUN " $rdm.Canonical_Name " ......."
$myesxcli.storage.core.device.setconfig($false,$rdm.Canonical_Name,$true)
$diskinfo = $myesxcli.storage.core.device.list($rdm.Canonical_Name) | Select -ExpandProperty IsPerenniallyReserved
$vmhost + " " + $rdm.Canonical_Name + " " + "IsPerenniallyReserved= " + $diskinfo
"----------------"
}
}
}
Try replacing that line with
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try replacing that line with
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That worked Champ... Thank you very much