People,
Can anyone here please assist me in fixing the script below so that it can display the vNIC type (VMXnet3 or e1000), Proper IP addressing that is not 169.254 for some multi NICs VM and also VM Port Group ?
Get-View -ViewType VirtualMachine -SearchRoot (get-cluster '*PROD*').id -Filter @{'Summary.Guest.ToolsVersionStatus'='guestToolsNeedUpgrade'} |
Select Name,
@{N="IP";E={$_.Summary.Guest.IpAddress}},
@{N='Guest OS';E={$_.Config.GuestFullName}},
@{N='VM Notes';E={$_.Summary.Config.Annotation}},
@{N="vNIC Type";E={((Get-VM $_.Name).NetworkAdapters).Type}},
@{N="PortGroup";E={((Get-VM $_.Name).NetworkAdapters).NetworkName}},
@{N='Tools Version';E={$_.Config.Tools.ToolsVersion}},
@{N='Tools Status';E={$_.Summary.Guest.ToolsVersionStatus}} |
Export-Csv -Path C:\VM-vNIC.csv -NoTypeInformation -UseCulture
This is my PowerCLI configuration:
PowerCLI Version
----------------
VMware PowerCLI 6.5 Release 1 build 4624819
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component 6.5 build 4624453
VMware VimAutomation Core PowerCLI Component 6.5 build 4624450
VMware HA PowerCLI Component 6.0 build 4525225
VMware Licensing PowerCLI Component 6.5 build 4624822
VMware Storage PowerCLI Component 6.5 build 4624820
VMware Vds PowerCLI Component 6.5 build 4624695
Thanks in advance.
Try like this
Get-View -ViewType VirtualMachine -SearchRoot (Get-Cluster '*PROD*').id -Filter @{'Summary.Guest.ToolsVersionStatus'='guestToolsNeedUpgrade'} |
Select Name,
@{N="IP";E={$_.Summary.Guest.IpAddress -join ','}},
@{N='Guest OS';E={$_.Config.GuestFullName}},
@{N='VM Notes';E={$_.Summary.Config.Annotation}},
@{N="vNIC Type";E={(Get-VM $_.Name | Get-NetworkAdapter).Type -join ','}},
@{N="PortGroup";E={(Get-VM $_.Name | Get-NetworkAdapter).NetworkName -join ','}},
@{N='Tools Version';E={$_.Config.Tools.ToolsVersion}},
@{N='Tools Status';E={$_.Summary.Guest.ToolsVersionStatus}} |
Export-Csv -Path C:\VM-vNIC.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
Get-View -ViewType VirtualMachine -SearchRoot (Get-Cluster '*PROD*').id -Filter @{'Summary.Guest.ToolsVersionStatus'='guestToolsNeedUpgrade'} |
Select Name,
@{N="IP";E={$_.Summary.Guest.IpAddress -join ','}},
@{N='Guest OS';E={$_.Config.GuestFullName}},
@{N='VM Notes';E={$_.Summary.Config.Annotation}},
@{N="vNIC Type";E={(Get-VM $_.Name | Get-NetworkAdapter).Type -join ','}},
@{N="PortGroup";E={(Get-VM $_.Name | Get-NetworkAdapter).NetworkName -join ','}},
@{N='Tools Version';E={$_.Config.Tools.ToolsVersion}},
@{N='Tools Status';E={$_.Summary.Guest.ToolsVersionStatus}} |
Export-Csv -Path C:\VM-vNIC.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
@LucD, thanks for the reply.
However, some of my servers got 169.254.x.x IP address ?
is there any reason why it is showing as APIPA instead of actual IP address ?
Maybe that's the case ?
We have no Cisco switching in the data center, maybe something else.
Somehow it is impacting only the single vNIC Exchange Server VMs that is on Windows Server 2012 R2 with VMXnet3 adapter ?
There is nothing wrong with this VMs in the production, it's just that the IP address returned is APIPA.
Afaik this looks more like a MSFT problem than a VMware problem.
Perhaps open a call with MSFT?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference