we back again after break , today my first post in 2018 wish to all of you happy new year full of joy and all you wishes become true
so today we will be talking about how to retrieve VMs IP Address
You can get the IP addresses for VMs from the virtual machine guest property
retrieve IP Address for one VM
(Get-VM -Name test01).Guest.IPAddress
for multi VMs
(Get-VM).Guest.IPAddress
or we can use this formate to get IP Address
Get-VM -Name test02 | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}}
or use this will give same result
Get-VM -name test02| Get-VMGuest | Format-Table VM ,IPAddress
Retrieve IP Address for all VMs
This is useful if you want to create a list of all your VMs with IP addresses and you can add more options like ‘Cluster , ESXI host , Datastore , powerstate … etc ‘
Get-VM | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}}
you can export to CSV
Get-VM | Select Name , powerstate , @{N="IP Address";E={@($_.Guest.IPAddress)}} | Export-CSV c:\vSaiyan.csv -NoTypeInformation
or use this will give same result
Get-VM | Get-VMGuest | Format-Table VM ,IPAddress
” The way to VMware PowerCLI ” Series Posts :
You must be logged in to post a comment.