2 Replies Latest reply on May 28, 2019 7:28 AM by jvm2016

    finding_list ofavailablevms_in totalvms_in_vcenter_powercli

    jvm2016 Hot Shot

      Hi Luc,

       

      can you please check why folowing code is not working .i am thinking to get found vms in $found.but its not happening for some reasons.

       

      $strings=Import-Csv -Path 'C:\Users\administrator\desktop\add_srm1.csv'

       

       

       

       

       

       

       

       

       

       

      $found=@()

       

       

       

       

      $vms_prod_vcenter=(get-vm).name

       

      foreach($vm in $strings)

      {

       

      $v= get-vm -name $vm.vmname

      $v.name

       

      if($vms_prod_vcenter -contains $v.name)

      {

      write-host "vm found" $v.name

       

      $v.name += $found

       

      }

      }

       

      $found