Find Linux VMs in VMware vsphere, PowerCLI, count

connect-viserver

(Get-VMguest * | Where-Object {$_.OSFullName -like “*Linux*” }).Count

get-vm | where{$_.Guest.OSFullName -match ‘linux’} | select name

Advertisements

ESX host or guest IP address inventory via PowerCLI

IPaddresses = @()

foreach($vm in Get-VM){     $vm.Guest.Nics | %{         $row = “” | Select Name, IP, MAC         $row.Name = $vm.Name         $row.IP = &{if($_.IPAddress){[String]::Join(‘,’,$_.IPAddress)}}         $row.MAC = $_.MacAddress         $IPaddresses += $row     } }

$IPaddresses = @()

Get-VMHost | Get-VMHostNetworkAdapter -VMKernel | %{     $row = “” | Select Name, IP, MAC     $row.Name = $_.VMHost.Name     $row.IP = $_.IP     $row.MAC = $_.MAC     $IPaddresses += $row }

$IPaddresses

 

or

 

Get-VMHostNetworkAdapter | select VMhost, Name, IP, SubnetMask | Export-Csv -NoTypeInformation C:\temp\host.csv