VMware Cloud Community
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Fixing the PowerCLI VM to pull some data from Get-View ?

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.

/* Please feel free to provide any comments or input you may have. */
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

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

AlbertWT
Virtuoso
Virtuoso
Jump to solution

@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 ?

/* Please feel free to provide any comments or input you may have. */
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I've seen that issue before.

Could this be caused by the issue described in KB1028373?

Or perhaps KB2012646?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

AlbertWT
Virtuoso
Virtuoso
Jump to solution

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.

/* Please feel free to provide any comments or input you may have. */
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos