1 Reply Latest reply on Aug 4, 2017 1:55 AM by LucD

    NIC/VMTool/Hardware Detail Along With OS Version

    sachdeva_2007 Lurker

      please help me with the script to put the required info.

      Run the below command but couldn't't join the OS version with NIC Version.

       

      $vms=Get-View -ViewType VirtualMachine

      $(

      foreach($vm in $vms){

      $networkcards=$vm.guest.net | ?{$_.DeviceConfigId -ne -1}

      ""|select  @{n="VM name";e={$vm.name}},@{n="uuid";e={$vm.config.uuid}},

      @{n="Net_info";e={[string]::join(',',  $($networkcards|%{$devid=$_.DeviceConfigId;[string]::join

      (',',$(($vm.config.hardware.device|?{$_.key  -eq $devid}).gettype().name,$_.network,($_.ipaddress -join ';'),

      $_.Macaddress))})  )}}

      }  Get-View -Property @("Name", "Config.GuestFullName", "Guest.GuestFullName") |

      Select -Property Name, @{N="Configured OS";E={$_.Config.GuestFullName}},  @{N="Running OS";

      E={$_.Guest.GuestFullName}}

      )

        • 1. Re: NIC/VMTool/Hardware Detail Along With OS Version
          LucD Guru

          You can do like this.

          But I'm not sure what info, besides the MacAddress, you want to see for the network cards.

          The code you listed is not making that clear to me.

           

          Get-View -ViewType VirtualMachine |

          Select  @{N="VM name";E={$_.Name}},

                  @{n="uuid";e={$_.config.uuid}},

                  @{N="MacAddress";E={($_.Guest.Net | Select -ExpandProperty MacAddress) -join ',' }},

                  @{N="Configured OS";E={$_.Config.GuestFullName}},

                  @{N="Running OS";E={$_.Guest.GuestFullName}}