2 Replies Latest reply on Oct 12, 2019 3:26 AM by vespavbb

    get Viserver from VM $_.

    vespavbb Novice

      Hi,

      is it possible to get the information of a VM on which VCenter the VM´s belongs?

      I´m asking, because we have more vcenters....

       

      connection to more vcenters example

      $vmlist =  get-vm  | sort name

       

       

      $myCol = @()

       

       

      foreach ($vm1 in $vmlist)

       

       

      {

       

         $vminfo =  $vm1 | Select name, Powerstate, NumCPU, MemoryGB,

       

       

          @{N="OS";E={$_.extensiondata.config.GuestFullName}},

       

       

          @{N="Cluster";E={$_.vmhost.parent}},

       

       

          @{N='vCenter';E={$_.get-viserverorsomethinglikethisName}}    # how can i get the vcenter back from the vm object?

       

       

          $myCol += $VMInfo

       

      }

      $mycol