4 Replies Latest reply on Nov 14, 2019 5:11 AM by ganapa2000

    Unable to get connect vcenter name

    ganapa2000 Hot Shot

      Hi,

       

      I am trying to get connect vCenter name from the below script, vcenter name shows blank in the output

       

      Connect-viserver -Server (Get-Content .\DEMO_VC.txt) > $null

      $VmInfo = Foreach($vc in $global:DefaultVIServers){

      ForEach ($VM in Get-Folder Dev | Get-VM)

      {

      ($VM.Extensiondata.Guest.Disk | Select @{N="Name";E={$VM.Name}},

      @{N="vCenter";E={$VM_.Uid.Split('@')[1].Split(':')[0]}},

      @{N="IPAddress";E={$VM.guest.IPAddress[0]}},

      @{N="VM PowerState";E={@($VM.PowerState)}},

      @{N="Operating System"; E={@($VM.guest.OSFullName)}},

      @{N="Folder";E={$VM.Folder.Name}}

      }

      }

      $VmInfo

       

      Please help..