2 Replies Latest reply on Jun 4, 2019 1:32 AM by ganapa2000

    Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl] does not contain a method named 'op_Addition'.

    ganapa2000 Hot Shot

      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

      "----------------"

      }

      }

      }